Hi Team,
i have a card layout and on click of it the section with contents should showup to the user. For this i have added a link on card layout but on first click it doesnot saves value to local!showDetails but on second click it does because of which my section remains hidden on first click and gets visible on second click.It should save value always. The section hide and show under a card is also controlled by an external link ExpandClicked as well. Suggest a way to achieve this.
link: a!dynamicLink( value: if( index( index( index( index( index( ri!final_PRN_CDT.PrnSegment.Providers, 1, {} ), "ServiceLocation", {} ), "Addresses", {} ), ri!index, {} ), "ExpandClicked", false() ) = true(), not(ri!final_PRN_CDT.PrnSegment.Providers[1].ServiceLocation.Addresses[ri!index].ExpandSegment), not(local!showDetails) ), saveInto: { local!showDetails, a!save( ri!final_PRN_CDT.PrnSegment.Providers[1].ServiceLocation.Addresses[ri!index].ExpandSegment, false() ), a!save( ri!final_PRN_CDT.PrnSegment.Providers[1].ServiceLocation.Addresses[ri!index].ExpandClicked, false() ) } )
Discussion posts and replies are publicly visible
I have one observation. Below is a CDT boolean property when i debugged i see it has empty value when form loads and on first card layout clcik its set to false then on second clcik showdetails is changing value.
index( index( index( index( index( ri!final_PRN_CDT.PrnSegment.Providers, 1, {} ), "ServiceLocation", {} ), "Addresses", {} ), ri!index, {} ), "ExpandClicked", false() )
This is very confusing ... In a case where I have a hard time to understand what is going on, I try to simplify my code and get rid of external dependencies.
1. First thing I would do is figure out why the value loads as empty into the interface.
As a side note your CDT design is very complex where you have 6 levels of nesting (waterfall effect) this is generally an anti-pattern
1. ri!final_PRN_CDT
2. PrnSegment
3. Providers[1]
4. ServiceLocation
5. Addresses[ri!index]
6. ExpandClicked
I would suggest to revisit these links to adjust your design
https://docs.appian.com/suite/help/23.2/cdt_design_guidance.html
https://community.appian.com/w/the-appian-playbook/1199/working-with-advanced-cdt-structures
2. Another simple solution is to simply do something of the sort
a!save( ri!final_PRN_CDT.PrnSegment.Providers[1].ServiceLocation.Addresses[ri!index].ExpandClicked, if( a!isNullOrEmpty( ri!final_PRN_CDT.PrnSegment.Providers[1].ServiceLocation.Addresses[ri!index].ExpandClicked ), true(), false() ) )
What kind of CDT have you created? You are going 6 levels down in a CDT?
We receive a structure of input which is nested and complex object json maximum upto six level down. That input we cast it to a similar CDT structure inorder to display in a dynamic interface.