Setting the occurence label of a roster before entering the roster

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Don
Posts: 55
Joined: February 15th, 2013, 1:28 pm
Location: Barbados

Setting the occurence label of a roster before entering the roster

Post 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?
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

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

Post 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;
Post Reply