Creating Valuesets From External File(dict & datafile)
Posted: September 10th, 2015, 1:08 am
I'm having a problem here about using an ARRAY to create Valuesets as follows;
I have a dictionary called COMPANY.DCF, and its data file COMPANY.DAT, I use this as an external dictionary to load all companies that fall in a certain categories. So after entering company's category code, then the program use this dictionary and its data file to load all the companies that fall within that category. In this dictionary we have variables namely, ccode(company code),catcode(category code), and cname(company name). ccode and catcode are all id fields.
The variables that I use to create the value sets from the loaded companies. I declared them in the GLOBAL as ARRAYS with sizes, example:
- array alpha(20) comp_name(20);
- array comp_code(20);
I assigns all company names to variable comp_name(i) and all company codes to comp_code(i), so that I can create a new value sets according to the loaded companies. Example:
i = 1;
While (loadcase(COMPANY)) Do
if Q204 = catcode then // Q204 is where category code is entered
comp_code(i) = ccode;
comp_name(i) = cname;
i=i+1;
endif;
Enddo;
SetValueSet(Q205,comp_code,comp_name);
Now the problems comes when the number of companies loaded is less than the size of those two arrays I declared in the GLOBAL, Arrays size is 20, assume number of companies loaded is 13, so when I assign those arrays to a value set of Q205 as it seen above, after 13th Value then it add other remaining 7 empty value sets (7 empty spaces) to make it 20, so I get a long list of 13 value sets and 7 more empty value sets (7 empty spaces).
My question is how to get rid of those seven empty value sets (empty spaces)?, or is there any possibility to change Array size after been declared in the GLOBAL before assigning new value sets to fit the number of companies loaded?
I can count number of cases loaded in the while do loop, but how can I change array size to the number of cases I counted?
Thanks, hope to hear from you soon.
I have a dictionary called COMPANY.DCF, and its data file COMPANY.DAT, I use this as an external dictionary to load all companies that fall in a certain categories. So after entering company's category code, then the program use this dictionary and its data file to load all the companies that fall within that category. In this dictionary we have variables namely, ccode(company code),catcode(category code), and cname(company name). ccode and catcode are all id fields.
The variables that I use to create the value sets from the loaded companies. I declared them in the GLOBAL as ARRAYS with sizes, example:
- array alpha(20) comp_name(20);
- array comp_code(20);
I assigns all company names to variable comp_name(i) and all company codes to comp_code(i), so that I can create a new value sets according to the loaded companies. Example:
i = 1;
While (loadcase(COMPANY)) Do
if Q204 = catcode then // Q204 is where category code is entered
comp_code(i) = ccode;
comp_name(i) = cname;
i=i+1;
endif;
Enddo;
SetValueSet(Q205,comp_code,comp_name);
Now the problems comes when the number of companies loaded is less than the size of those two arrays I declared in the GLOBAL, Arrays size is 20, assume number of companies loaded is 13, so when I assign those arrays to a value set of Q205 as it seen above, after 13th Value then it add other remaining 7 empty value sets (7 empty spaces) to make it 20, so I get a long list of 13 value sets and 7 more empty value sets (7 empty spaces).
My question is how to get rid of those seven empty value sets (empty spaces)?, or is there any possibility to change Array size after been declared in the GLOBAL before assigning new value sets to fit the number of companies loaded?
I can count number of cases loaded in the while do loop, but how can I change array size to the number of cases I counted?
Thanks, hope to hear from you soon.