Dear all,
I would like to know if there's a way to use and compare values previously entered in a case(form) with one who's being entered?
Assuming the value date have been already entered in the Case(form) number 1 and now i'm entered the case (form)2. I would like to know how to compare date's field for theses two cases.
Thanks in advance.
HTUSER
Using previously entered value
Using previously entered value
G.VOLNY, a CSProuser from Haiti, since 2004
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Using previously entered value
There are two ways to do this, but neither are very straightforward:
1) Store the value in a temporary variable (declared in the PROC GLOBAL section). The problem with this approach is that the value of these variables only last for your current data entry session, so if you close the program and open it again, then the value will start out as 0, which was not necessarily the previous value.
2) Use an external dictionary (lookup file) to write out the variables that you want to compare to a separate file and then read them in for the comparison.
1) Store the value in a temporary variable (declared in the PROC GLOBAL section). The problem with this approach is that the value of these variables only last for your current data entry session, so if you close the program and open it again, then the value will start out as 0, which was not necessarily the previous value.
2) Use an external dictionary (lookup file) to write out the variables that you want to compare to a separate file and then read them in for the comparison.
Re: Using previously entered value
Thanks for answers. The problem with the second solution is that, keyer must choose external dictionnary (as the lookup example file). So they can modify it (.dcf file are not encrypted as .ent). I think this is a lack of a special function in the cspro's language. However it will be very useful to have a such function allowing to compare data's (item) between cases across different data entry sessions.
Sincerely yours,
Sincerely yours,
G.VOLNY, a CSProuser from Haiti, since 2004
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Using previously entered value
If you're worried about keyers changing the value of the external data file, you can set it to a junk file and then use the setfile to change it to the actual file from within logic. That way the keyer won't know the name of the file containing the values.
Re: Using previously entered value
I was looking in the examples folder to unsderstand more from using external lookup dictionnary and file. It's seem not very dificult to do. But, i'm little confusing for the use of the setfile...An exemple from you will be welcome!
Thanks in advance.
Thanks in advance.
G.VOLNY, a CSProuser from Haiti, since 2004
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Using previously entered value
As an example, this code sets the external dictionary to a dynamically created file name (comprised of the operator ID) and then reads the entire file, filling two rosters with information about whether cases were submitted (CS) or are in progress (CIP).
function readOperatorWorkFile()
setfile(CIPS2013_OPERATORWORK_DICT,maketext("%sActions_%s.dat",pathname(InputFile),strip(OPERATOR_ID)));
numCasesInProgress = 0;
numCasesSubmitted = 0;
if not locate(CIPS2013_OPERATORWORK_DICT,>=,"") then
exit;
endif;
while loadcase(CIPS2013_OPERATORWORK_DICT) do
if SUBMITTED = 1 then
inc(numCasesSubmitted);
CS_PROV(numCasesSubmitted) = OW_PROV;
CS_DIST(numCasesSubmitted) = OW_DIST;
CS_REGION(numCasesSubmitted) = OW_REGION;
CS_VILLAGE(numCasesSubmitted) = OW_VILLAGE;
CS_EA(numCasesSubmitted) = OW_EA;
CS_ACTION(numCasesSubmitted) = ACTION;
CS_ACTION_STR(numCasesSubmitted) = getlabel(ACTION,ACTION);
CS_DATE_SUBMITTED(numCasesSubmitted) = convertDate(DATE_SUBMITTED);
else
inc(numCasesInProgress);
CIP_PROV(numCasesInProgress) = OW_PROV;
CIP_DIST(numCasesInProgress) = OW_DIST;
CIP_REGION(numCasesInProgress) = OW_REGION;
CIP_VILLAGE(numCasesInProgress) = OW_VILLAGE;
CIP_EA(numCasesInProgress) = OW_EA;
CIP_ACTION(numCasesInProgress) = ACTION;
CIP_ACTION_STR(numCasesInProgress) = getlabel(ACTION,ACTION);
CIP_DATE_LAST_WORKED(numCasesInProgress) = convertDate(DATE_LAST_WORKED);
endif;
enddo;
NUM_CS = numCasesSubmitted;
NUM_CIPS = numCasesInProgress;
end;
setfile(CIPS2013_OPERATORWORK_DICT,maketext("%sActions_%s.dat",pathname(InputFile),strip(OPERATOR_ID)));
numCasesInProgress = 0;
numCasesSubmitted = 0;
if not locate(CIPS2013_OPERATORWORK_DICT,>=,"") then
exit;
endif;
while loadcase(CIPS2013_OPERATORWORK_DICT) do
if SUBMITTED = 1 then
inc(numCasesSubmitted);
CS_PROV(numCasesSubmitted) = OW_PROV;
CS_DIST(numCasesSubmitted) = OW_DIST;
CS_REGION(numCasesSubmitted) = OW_REGION;
CS_VILLAGE(numCasesSubmitted) = OW_VILLAGE;
CS_EA(numCasesSubmitted) = OW_EA;
CS_ACTION(numCasesSubmitted) = ACTION;
CS_ACTION_STR(numCasesSubmitted) = getlabel(ACTION,ACTION);
CS_DATE_SUBMITTED(numCasesSubmitted) = convertDate(DATE_SUBMITTED);
else
inc(numCasesInProgress);
CIP_PROV(numCasesInProgress) = OW_PROV;
CIP_DIST(numCasesInProgress) = OW_DIST;
CIP_REGION(numCasesInProgress) = OW_REGION;
CIP_VILLAGE(numCasesInProgress) = OW_VILLAGE;
CIP_EA(numCasesInProgress) = OW_EA;
CIP_ACTION(numCasesInProgress) = ACTION;
CIP_ACTION_STR(numCasesInProgress) = getlabel(ACTION,ACTION);
CIP_DATE_LAST_WORKED(numCasesInProgress) = convertDate(DATE_LAST_WORKED);
endif;
enddo;
NUM_CS = numCasesSubmitted;
NUM_CIPS = numCasesInProgress;
end;
Re: Using previously entered value
Dear Gregory,
Thanks for all's answers. We understand this is not easy for you to work on the android version of Cspro and provide answers for all's questions from users.
But, an example with dictionary, logic and fmf files would be more useful for understand theses codes.
Thanks in advance.
Thanks for all's answers. We understand this is not easy for you to work on the android version of Cspro and provide answers for all's questions from users.
But, an example with dictionary, logic and fmf files would be more useful for understand theses codes.
Thanks in advance.
G.VOLNY, a CSProuser from Haiti, since 2004