I am using an External dictionary to fill my ID items and have protected 3 out of 4 ID items, 1 is unprotected for loadcase to fill rest of the dictionary item. If we enter in unprotected field (which is unique) function should check if this number used before or not. If the number is already used then an errmg should appear. Please explain the process to use the find function or any function which can create condition for reflection of error message before system generated msg appears.Gregory Martin wrote: ↑May 4th, 2017, 7:51 am If using 7.0 (which you have to for keylist), you can also use the find function on the input dictionary. Construct the potential key as a string, and then do something like this:
if find(INPUT_DICT,=,keyString) then
errmsg("You've already entered a case with these IDs");
endif;
Find duplicate cases in input dictionary
Find duplicate cases in input dictionary
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Find duplicate cases in input dictionary
You are going to get that system message as soon as you enter the ID field, so what you can do is add an item to your dictionary (to a record, not the IDs), and then have the user enter the ID value to that field. You can then assign it automatically to the ID field. Something like this:
PROC ENTERED_HH
if find(DICT_NAME, =, maketext("%v%v%v", PROVINCE, DISTICT, ENTERED_HH)) then
errmsg("You cannot enter another household %v.", ENTERED_HH);
reenter;
endif;
// assign the entered household number to the real ID;
// HH will be on the form, protected, after ENTERED_HH
HH = ENTERED_HH;
if find(DICT_NAME, =, maketext("%v%v%v", PROVINCE, DISTICT, ENTERED_HH)) then
errmsg("You cannot enter another household %v.", ENTERED_HH);
reenter;
endif;
// assign the entered household number to the real ID;
// HH will be on the form, protected, after ENTERED_HH
HH = ENTERED_HH;
Re: Find duplicate cases in input dictionary
Thank you sir. It worked