Itemlist function

Discussions about CSEntry
Post Reply
Habtamu
Posts: 7
Joined: March 18th, 2024, 4:18 am

Itemlist function

Post by Habtamu »

Dear Cspro Support team
How are you all? I need some assistance with itemlist function in cspro.Now Iam using latest version of cspro 8. itemlist function not supported in version 8, but in older version 7 it works well. Please I need help if any other supported function replaced with Itemlist

Here I have using on the older version

if locate(FORM_1_DICT,>=, itemlist(ENUMERATOR_ID, L_V01, L_V02, L_V03, L_V04,L_V05,A01)) and retrieve(FORM_1_DICT) then
/// Make sure this is a match since locate with >= can return something in another region
if ENUMERATOR_ID = F_ENUMERATOR_ID and L_V01 = V01 and L_V02 = V02 and L_V03 = V03 and L_V04 = V04 and L_V05 = V05 and A01 = f then
// Add entry to value set for this woreda
codes(nextEntry) = A01;
labels(nextEntry) = strip(A02);
inc(nextEntry);
endif;
endif
enddo;



Here below the error message when compiling

ERROR(FV06, 434): The itemlist function is no longer supported in CSPro
ERROR(FV06, 441): Expecting 'enddo'
ERROR(FV06, 442): PostProc clause expected
ERROR(FV08, 464): The itemlist function is no longer supported in CSPro
ERROR(FV08, 472): Expecting 'enddo'
ERROR(FV08, 473): PostProc clause expected
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Itemlist function

Post by Gregory Martin »

You can replace itemlist calls with maketext with the %v formatter, which formats values as they are defined in the dictionary:
itemlist(ENUMERATOR_ID, L_V01, L_V02, L_V03, L_V04, L_V05, A01)

maketext("%v%v%v%v%v%v%v", ENUMERATOR_ID, L_V01, L_V02, L_V03, L_V04, L_V05, A01)
Habtamu
Posts: 7
Joined: March 18th, 2024, 4:18 am

Re: Itemlist function

Post by Habtamu »

Thank you, Gregory Martin, for quick response it I appreciate it for your quick response. it is done now but on setvalueset function there is some compiling error.
numeric nextEntry = 1;
do varying numeric f = 1 while f <= 999
ENUMERATOR_ID = F_ENUMERATOR_ID;
L_V01 = V01;
L_V02 = V02;
L_V03 = V03;
L_V04 = V04;
L_V05 = V05;
A01=f;
if locate(FORM_1_DICT,>=, maketext(ENUMERATOR_ID, L_V01, L_V02, L_V03, L_V04,L_V05,A01)) and retrieve(FORM_1_DICT) then
if ENUMERATOR_ID = F_ENUMERATOR_ID and L_V01 = V01 and L_V02 = V02 and L_V03 = V03 and L_V04 = V04 and L_V05 = V05 and A01 = f then
codes(nextEntry) = A01;
labels(nextEntry) = strip(A02);
inc(nextEntry);
endif;
endif
enddo;
codes(nextEntry) = notappl;
setvalueset($, codes, labels);

Compile error is as below

ERROR(39): Creating value sets with Array objects is no longer supported. Use the ValueSet object to create dynamic value sets
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: Itemlist function

Post by justinlakier »

Hello,

It's just as the compile error message says. You can no longer use arrays for value sets, and must use the new ValueSet Object which you can declare with ValueSet Statement. Further functions like adding to or clearing the object are listed in the Object's documentation page along with demonstrations. Here is the blog post with some more explanations and examples.

Hope this helps,
Justin
Habtamu
Posts: 7
Joined: March 18th, 2024, 4:18 am

Re: Itemlist function

Post by Habtamu »

Justin, thank you for assisting me. It is done now.
Post Reply