Skip to main content
vaishalig4654
June 14, 2023
Question

not function unable to save value in dynamic link

  • June 14, 2023
  • 5 replies
  • 0 views

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()
          )
        }
      )

5 replies

vaishalig4654
June 14, 2023

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()
          )

stefanhelzle0001
Brainy
June 14, 2023

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.

Known Participant
June 14, 2023

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()
    )
)
 

harshitb6843
June 14, 2023

What kind of CDT have you created? You are going 6 levels down in a CDT? [emoticon:9b0593ccae51484a9fd4cdacd0c90a69]

vaishalig4654
June 16, 2023

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.