21
Views
2
Comments
Solved
Show/Hide list item based on value in previous item
Application Type
Reactive
Service Studio Version
11.54.24 (Build 62760)

I am creating a form where users can specify the options for different questions. I want to hide all remaining questions when certain options are selected. Let me give an example.


Q1: Answer/HideRemainingQuestions

 - 1A / False
 - 1B / True

Q2: 
 - 2A / False
 - 2B / True

Q3:

 - 3A / False
 - 3B / False

  • In the form, if the user selects 1B, Q2 & Q3 will not be shown on the form.
  • If the user selects 1A and 2B, Q3 will not be shown on the form.

I want to be able to set the Visible attribute for Q2 & Q3 based on the HideRemainingQuestions value of the option selected in Q1. Similarly, if Q2 is visible, I want to set the Visible attribute for Q3 based on the HideRemainingQuestions value of the option selected in Q2.

I hope this makes sense. 

Is there a way to reference a value in the previous item in an aggregate?

Solution

Hello.

Yes it is possible. If you have the aggregate GetMyData, you can index the previous value by:

GetMyData.List[GetMyData.List.CurrentRowNumber - 1].Value.

Be careful to do not use this expression on the first row.

Hello!

Yes, this is possible! And to me, it seems like there's more than one way to achieve this.

Can you share your .oml file? So I can help you find the solution that best suits your scenario :)

Best regards,

Miguel

Solution

Hello.

Yes it is possible. If you have the aggregate GetMyData, you can index the previous value by:

GetMyData.List[GetMyData.List.CurrentRowNumber - 1].Value.

Be careful to do not use this expression on the first row.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.