nansat99
24th April 2006, 20:39
Hi,
I have a table whose index is prodid,orderdate, so when we enter same combination of prodid and orderdate, "record already exists" message is shown.
Is there a way to modify the message like "record already exists, do you want to modify?" ,
precisely, how can we avoid the message "record already exists"?
thanks
nansat99
mark_h
24th April 2006, 21:04
Without knowing more details on the session my first thought is that in the check.input you check to make sure the record is not present. If it is present you can do what every you want - give error message or execute a find. You will need to figure out which event actually provides the message. You can probably trap it in main table io before.write event. I have not really trapped an error like that, but on one multi-occurence session I do this:
choice.start.set:
after.choice:
on.main.table(check_found)
if found then
execute(find.data)
endif
For the start set it runs routine check_found - if the view fields(primary index fields) already exist then it does a execute find.
nansat99
25th April 2006, 17:46
Hi mark,
thanks for your reply and I tried in check.input. It is showing me the message which i needed followed by record already exists (database message). How can I avoid the system shown message ?
I tried in choice sections, nothing worked. only with check.input atleast I am getting my message.
Also "Record already exists, Do you want to modify?" If no, choice.again(),
If yes record has to goto the existing combination record ? How this can be done ?
thanks
Nansat
mark_h
25th April 2006, 18:12
What kind of session is it? Single or multi occurence? Maybe a screen shot would help. The thing that keeps coming to my mind is the problem with the primary index - and modifying those fields. Maybe a screen shot of the session and the complete script will help.
nansat99
25th April 2006, 19:08
I have attached code and session screenshot
mark_h
25th April 2006, 20:50
Well I would probably keep it simple - I would use check.input. So lets say after they enter prod-id - in check.input you would look to see if it exists. If it does pop up a message and use input.again. You could check after which ever field you want. I do not see where I actually tried this on this type of session. The problem as I see it is you are trying to take them from insert mode, to find mode, then modify mode. I know this is not the answer you are looking for, but I do not recall doing this. I have a multi-occ session with view fields that finds a record, but it does not return the record already exists error.
Something else you can do is something like this for those case statements:
domain tcmcs.str8 somevar, somesern
somevar = "00000000"
somesern = somevar(1;8-len(str$(tiudi903.sern))) & str$(tiudi903.sern)
You can play with the lengths to make it meet your needs. I think your variable is already string and the same above I used an integer.
nansat99
25th April 2006, 20:56
thanks for your reply.. but if "do you want to modify?" is yes the record (existing record with that combination) has to be brought (not highlight), and non index fields should be made focussed.
thanks
nansat
mark_h
25th April 2006, 22:01
Thats the problem as I see it - switching from insert to modify. I am not saying it can't be done, but I have never tried it with just the main session. I have created input sub-sessions for the users to do things like input a record, delete records, etc - but I do not know of way to do what you are asking. If you know a baan session that does this then I would see how it works - otherwise you may have to wait for one of the real gurus.
nansat99
1st May 2006, 21:11
Hi Real Baan Guru s,
Can you please look at this thread and let me know how to proceed.
thanks
nansat