I have a repeater that gets unique order numbers. Each repeater row displays a table for each order number.
I want to hide all repeater rows where the child table has no rows.
I have searched the documentation but cannot find anything that tells you the FPL syntax for table.rowcount. I've tried adding the filter expression MYTABLE.ROWCOUNT > 0 but this crashes the application.
What is the right way to do this ?
Hide empty repeater rows
Moderators: Jon, Steve, Ian, Dave
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
The way I have done this in the past is to add an additional column, say ROW_COUNT, to the parent table (orders) - don't display this column to the user. If possible, populate this from the database with the count of child record rows (is your table data coming from a database?) when you load the rest of the data. Then loop through the table, check for 0 records and hide/show the repeater row control as appropriate.
Regards
Jon
Regards
Jon
0 x
-
- Ebase User
- Posts: 86
- Joined: Thu Mar 08, 2018 2:52 pm
Re: Hide empty repeater rows
Is there also a more elegant solution possible? Can you explain how you solved this Segi?
0 x
-
- Ebase User
- Posts: 649
- Joined: Mon Dec 09, 2013 6:37 pm
Re: Hide empty repeater rows
Here's how I did it:
Users_2 is the parent table and SIGNATURETYPES is the child table
The logic behind this, if you're interested, is for each user, display the signature types that they are authorized for. If there aren't any signatures that the user is authorized for, hide the user row entirely.
Users_2 is the parent table and SIGNATURETYPES is the child table
The logic behind this, if you're interested, is for each user, display the signature types that they are authorized for. If there aren't any signatures that the user is authorized for, hide the user row entirely.
Code: Select all
var allUsers=tables.USERS_2;
var allUserRows=allUsers.getRows();
var allSignatureTypes=tables.SIGNATURETYPES;
while (allUserRows.next()) {
var parentRow=allSignatureTypes.findRow(allSignatureTypes.REALNAME,allUsers.REALNAME.value);
// No SignatureTypes rows
if ( parentRow == -1 ) {
tables.USERS_2.REALNAME.fieldControl.parentControl.setHidden(true);
} else {
tables.USERS_2.REALNAME.fieldControl.parentControl.setHidden(false);
}
}
Last edited by Segi on Fri Jul 12, 2019 3:03 pm, edited 1 time in total.
0 x
-
- Ebase User
- Posts: 86
- Joined: Thu Mar 08, 2018 2:52 pm
Re: Hide empty repeater rows
Thank you Segi! Looks good. I will give it a try.
I was not aware that's possible to control the display of controls upfront for all records.
Update: Works. Thanks
I was not aware that's possible to control the display of controls upfront for all records.
Update: Works. Thanks
0 x
Who is online
Users browsing this forum: No registered users and 119 guests