I am using GeneXus X Evolution 3 – Version 10.3.98441 U5
I am compiling RPG for AS/400 platform.
My challenge is that I need to filter out records with a certain status value when I load a grid in a work panel. I’ve finally gotten my program to filter out unwanted records, but now it is only displaying the last valid record. Is this a common problem? Or something someone has encountered before?
Here is the event code from my work panel.
Event Load
for each
where RecordStatus = 'ACT'
&nUserId = nullValue(&nUserId) // clear the note author variable
&nDate = nullValue(&nDate) // clear the date the note was created
if RecordNoteLine = 1 // only put printable values on the first line
&nDate = DtoC(RecordDate)
call(Prog0364, RecordWho, &nUserId) // get userID from emp no
endif
¬eUserId = &nUserId
¬eDate = &nDate
¬eText = RecordNotes
MyGrid.Load()
endfor
Endevent
The purpose of nulling the user ID and date is to only display the user ID and date(as a character field) on the first line of the record display. The purpose of this block is to only display active records. It is a requirement of the project to use a soft delete ('DEL' status) and only display active records.
I am very new to using GeneXus, RPG, and developing on any mainframe platform, so any help would be greatly appreciated.
Through a bit of "playing around" and testing various outcomes, I arrived at the following for a (the?) solution to my problem:
Event Load
for each
where RecordStatus = 'ACT'
&nUserId = nullValue(&nUserId) // clear the note author variable
&nDate = nullValue(&nDate) // clear the date the note was created
if RecordNoteLine = 1 // only put printable values on the first line
&nDate = DtoC(RecordDate)
call(Prog0364, RecordWho, &nUserId) // get userID from emp no
endif
¬eUserId = &nUserId
¬eDate = &nDate
¬eText = RecordNotes
Load // <--- THIS is key and obviously I misunderstood when told to use a "load"
// I was ignorant of what that was, so I looked it up and found
// the original code that didn't work for me.
endfor
Endevent