I have a table with individual names called "Identities". Within each row is a Section widget that as the "Title" section displaying the name of the individual. When a user clicks on the name, I have an action that sets a variable called "Display" to equal "True" and a variable called "IdentityID" to equal the "ID" field value of the record that was clicked on.
Within the "Content" portion for the Section widget I have Block element that takes an input parameter of "IdentityID" to filter an aggregate to pulls just the related "TimeLine" records associated with that Identity ID.
I want to wrap the Block element in an IF statement that displays the Block results when the variable "Display" is set to "True" and the "IdentityID" variable I passing into it is equal to the value in the "IdentityID" field value within the TimeLine table.
How do I pass the value of each TimeLine record's "IdentityID" value back up to the parent IF statement to compare against the "IdentityID" variable so that I only show the related records from Timelines for that specific individual? I believe it's to use events but I haven't been able to figure it out.
Right now my record set shows each individual as it should:
But when I click to expand Richard's record, not only does it show me his related records, but it shows his records for the individuals:
What I want to see is this:
Hi @Richard Dwyer
I have attached an .oml with the a possible solution for your problem. This is utilising list instead of table (as in your case), but it will give you an idea.
You can access the demo by clicking on the below link -
https://personal-cscpmcir.outsystemscloud.com/TestFeature/ExpandDemo
For your scenario -
1. You need to create a new Boolean attribute column in the aggregate of your parent block. This will control the expand and collapse of the timeline block.
2. The ID of the parent record should be directly passed into the child block and not stored in an individual variable.
Thanks,
Rahul Yadav
Thanks for this. I've implemented it and it works but I'm trying to understand the thinking behind this method.
So you are attaching an attribute (IsExpanded) to the aggregate that is set either to True or False based upon button click for the action "ExpandCloseOnClick". So the new attribute tells the list when it is being rendered whether to make the child block visible or not and then utilizing "OnParametersChange" your calling a refresh of the customer list so the page updates.
Make sense. But I would think the more direct way to do this would be to pass the customer ID to a variable, either input or local and then have the logic to either show or hide the child block based upon whether the ID in child block list value is equal to the customer ID in the input/local variable. Why does this method not work?
And one final question, if I wanted to disable the the ExpandCloseOnClick action if there are no related customer details entered in the child block, how would I achieve that?
For the first question, you need to think this as list of child blocks getting rendered on each expansion. If you maintain local variable you will need to create as many local variable as the number of records in the list, to capture customer Id for every expansion.
Checking Customer Id in child block wont work straight away.
Second question - You can put an on-demand aggregate that refreshes from within ExpandCloseOnClick client action, before changing IsExpand value. If the aggregate is empty then you can leave the IsExpand to be false otherwise change it to true. If you follow this approach, then you don't even need to pass the ID to the child block. You can pass the data to display in the child block directly from the on-demand aggregate result.
Hope this helps.
Thanks
Rahul,
Thank you for the assistance. A further question if I may...
When I have a record expanded, if I don't click to close that record and I instead click on an new record, is there a way to automatically close the previous record?
I have attached a solution for your question.