Page 1 of 1

working with the record as a group item

Posted: December 9th, 2019, 10:08 am
by AriSilva
Is there a way to refer to the whole contents of a record?
For example, a record type has many variables, and I want to write them all in to a write command, such as
write("%s", person_record_edt);
without having to create a group item, or naming them one by one.
Best

Re: working with the record as a group item

Posted: December 9th, 2019, 12:45 pm
by josh
Unfortunately there is no way to do that. It would be very useful though.

Re: working with the record as a group item

Posted: December 10th, 2019, 8:24 am
by AriSilva
Could you "move" that to feature requests, then?

Re: working with the record as a group item

Posted: December 10th, 2019, 8:48 am
by Gregory Martin
Try this, it might give you want you want:
write("%s", itemlist(PERSON_RECORD));

Re: working with the record as a group item

Posted: December 10th, 2019, 9:21 am
by htuser
Good news to have a way to write a record in a shorten way. Thanks a lot Greg. However, we would like to know if :
1.- can we have a workaround to write record item label instead of code?
2.- Can we have some basic help for undocumented reserved word?
Thanks in advance,

Re: working with the record as a group item

Posted: December 10th, 2019, 1:50 pm
by Gregory Martin
Itemlist was added a long time ago (4.1 maybe) to simplify what you can now do with %v. For example:
itemlist(A, B, C) = maketext("%v%v%v", A, B, C)
It's convenient to use because it also takes a record name. However, it is not documented because it will likely be removed in a future release.

Re: working with the record as a group item

Posted: December 10th, 2019, 2:22 pm
by htuser
Thanks Greg. This explanation is very clear. However what we need is to have a way to write the content of a record, (label, not code) to a report (templated record). So, i think that the itemlist(RECORD) could do the job. But. it seem that there's no way to ouput label...
If questionnaire case is parsed in the CSdb/CSdbe, including valueset as relational table to code (as it's in CSPro2SQL), this will solve this demand.
Best,