create a separate file
-
- Posts: 72
- Joined: March 17th, 2012, 10:46 am
create a separate file
Dear George and team,
Is it possible to create a separate file with some variables, when doing the data entry it should write data in different file simultaneously. If possible will you please give example.
If not is it possible in batch file.
Thanks in advance,
P.P
Is it possible to create a separate file with some variables, when doing the data entry it should write data in different file simultaneously. If possible will you please give example.
If not is it possible in batch file.
Thanks in advance,
P.P
Re: create a separate file
You can use an external dictionary along with the writecase function to write data to an external file. There is an example called "Using External Files & Forms" in the examples directory (C:\Program Files (x86)\CSPro 6.3\Examples).
-
- Posts: 72
- Joined: March 17th, 2012, 10:46 am
Re: create a separate file
Thanks Josh, i will check it.
-
- Posts: 72
- Joined: March 17th, 2012, 10:46 am
Re: create a separate file
Dear Jose,
In continuation with previous post, for creating a separate file with some variables, I have tried with your suggestion using writecase function, but I am facing error of
ERROR: Variable(s) length do not agree with dictionary id-length near line 5 in LFSTATE_CODE procedure.
Even, I have check the length of variables is same in the both dictionary, still I don’t have clue. Will you please help me out, for your reference I have enclosed my application.
Thanks in advance.
Prabhu
In continuation with previous post, for creating a separate file with some variables, I have tried with your suggestion using writecase function, but I am facing error of
ERROR: Variable(s) length do not agree with dictionary id-length near line 5 in LFSTATE_CODE procedure.
Even, I have check the length of variables is same in the both dictionary, still I don’t have clue. Will you please help me out, for your reference I have enclosed my application.
Thanks in advance.
Prabhu
- Attachments
-
- MDR_TB_LF.zip
- (18.89 KiB) Downloaded 326 times
Re: create a separate file
Dear prabhustat,
I know you asked Josh to help you facing your error, but maybe I can help.
That error is because you need to list all the ID variables that identifies the case of your external dictionary.
Here is a more explicit:
Writecase Function
Format:
b = writecase(ext-dict-name[,var-list]);
Description:
The writecase function writes a case from memory to an external data file. It can be used to update existing cases or to write new ones.
The ext-dict-name must be supplied. It is the internal name of the dictionary defined in the application for the external file.
The optional var-list defines the case identifiers in the external file. The writecase function concatenates the variables specified in var-list to form a string whose length must be the same as the length of the case identifier in the external dictionary. All variables in the var-list must exist in a dictionary or working storage. If no var-list is provided, the current values of the identifiers in memory for the external file are used.
So in your LFSTATE_CODE procedure you can try the following:
Hope this can help you.
Regards.
I know you asked Josh to help you facing your error, but maybe I can help.
That error is because you need to list all the ID variables that identifies the case of your external dictionary.
Here is a more explicit:
Writecase Function
Format:
b = writecase(ext-dict-name[,var-list]);
Description:
The writecase function writes a case from memory to an external data file. It can be used to update existing cases or to write new ones.
The ext-dict-name must be supplied. It is the internal name of the dictionary defined in the application for the external file.
The optional var-list defines the case identifiers in the external file. The writecase function concatenates the variables specified in var-list to form a string whose length must be the same as the length of the case identifier in the external dictionary. All variables in the var-list must exist in a dictionary or working storage. If no var-list is provided, the current values of the identifiers in memory for the external file are used.
So in your LFSTATE_CODE procedure you can try the following:
Code: Select all
PROC LFSTATE_CODE
LFSTATE_CODE1 = LFSTATE_CODE;
LFDISTRICTS_CODE1 = LFDISTRICTS_CODE;
MONTIL1 = MONTIL;
DATE_YEARL1 = DATE_YEARL;
MDR_CASE_UNIQUEL1 = MDR_CASE_UNIQUEL;
SESSION1 = SESSION;
if not loadcase(MDR_EXT_DICT,LFSTATE_CODE1) then
enter MDR_Ext_FF;
writecase(MDR_EXT_DICT,LFSTATE_CODE1,LFDISTRICTS_CODE1,MONTIL1,DATE_YEARL1,MDR_CASE_UNIQUEL1,SESSION1);
endif;
Regards.
-
- Posts: 72
- Joined: March 17th, 2012, 10:46 am
Re: create a separate file
Sorry for late respond, Thanks, I will check
-
- Posts: 72
- Joined: March 17th, 2012, 10:46 am
Re: create a separate file
Thanks Jfigueroa, the error rectified, but the issue now I am facing after entering the state code, the cursor moving to write file variable of state code, I think it’s supposed to protect and silently capture in the backend. I have six identification variables and ten other variables, let me know is it possible.
Or any other way like creating batch file to capture the information. I am struggling a lot, will you please suggest, it would be a great help. I have enclosed the program for your reference.
Thanks in advance.
Prabhu
Or any other way like creating batch file to capture the information. I am struggling a lot, will you please suggest, it would be a great help. I have enclosed the program for your reference.
Thanks in advance.
Prabhu
- Attachments
-
- MDR_TB_LF.zip
- (18.94 KiB) Downloaded 327 times
Re: create a separate file
The line "enter MDR_Ext_FF;" sends you to the external form. Do you need the external form here? If all you want to do is write the variables from the first form to the external file you can remove the "enter MDR_Ext_FF;" and proceed directly with the writecase. Then you can remove the form (File menu-->Drop Files) and just use the external dictionary. You only need the external form if you want the user to enter data using the form.
-
- Posts: 72
- Joined: March 17th, 2012, 10:46 am
Re: create a separate file
Thanks Josh, I will try. Let me is't possible in batch mode.
Thanks,
Prabhu
Thanks,
Prabhu
Re: create a separate file
Sorry prabhustat, I rarely check the forum on weekends.
Hope Josh´s advice helps.
Regards.
Hope Josh´s advice helps.
Regards.