Page 1 of 1

Setting the occurence label of a roster before entering the roster

Posted: June 6th, 2018, 10:08 am
by Don
Hi,

I want to display names of persons on the occurrence labels when opening a case that has been previously entered. This way I'll see names instead of population(1), population(2) etc when opening a case in android. I've tried the following:

Code: Select all

PROC PART_A	//This is the level proc
onfocus
	do i = 1 while i <= totocc(POPULATION000)		//DEBUG: totocc and count both return 0 if executed before the roster that they are referring to
		setocclabel(POPULATION000(i), strip(FIRST_NAME(i)));	//first roster
		setocclabel(POPULATION001(i), strip(FIRST_NAME(i)));	//second roster
	enddo;
I tried both totocc() and count() but It turns out that both of them evaluate to 0 until I actually enter the roster. This results in all the occurrence labels being changed to only the name of the first person. Is there a way to get the total number of roster items or to loop through all the roster items?

Re: Setting the occurence label of a roster before entering the roster

Posted: June 7th, 2018, 6:52 am
by Gregory Martin
There are a series of occurrence functions that you could look into, but I usually write code like this:
PROC PART_A   //This is the level proc

onfocus

do i = 1 while i <= maxocc(POPULATION000) and FIRST_NAME(i) <> ""
        setocclabel(POPULATION000(i), strip(FIRST_NAME(i)));   //first roster
        setocclabel(POPULATION001(i), strip(FIRST_NAME(i)));   //second roster
    enddo;