Hello, I would like to ask a question regarding the reevaluation of S

Hello,

I would like to ask a question regarding the reevaluation of SAIL interfaces, one that I have not been clear on so far.
Does ANY user interaction with SAIL components cause the whole interface to be reevaluated?
For example, changing the value of a radioButton or the value of a textField, would that cause the whole SAIL interface to be reevaluated?
And reevaluation, if I have understood correctly, means that all expressions within all SAIL components of an interface will be reevaluated, even to return the same result that is already being displayed.

Also, I have a question regarding the with() function, in relation to my previous question, that stems from the implementation of cascading drop down fields.

We have been using a series of cascading drop down fields where the choices of each drop down field must be updated from the database using the selected value of the previous drop down field. Now, given that each drop down field is within a ...

OriginalPostID-156756

OriginalPostID-156756

  Discussion posts and replies are publicly visible

  • ...with() function, the query of each drop down field would be executed every time any other SAIL component of that interface changes regardless of the fact that the value of any drop down field has NOT been changed and regardless of the fact that result of each query is the same as what is already displayed in the list of choices of the drop down fields.

    Since this seems like an overhead in terms of DB execution, we have found another way to implement cascading drop down field scenarios, a way that I have not seen mentioned in the documentation. The way we have implemented these scenarios is by removing the with() functions for the drop down fields and by executing the query to the DB, in order to retrieve the choices of the next drop down field, in a a!save() function in the saveInto section of the drop down field whose value has just been changed.

    Is anyone aware if the implementation I have just described is not recommended or if anyone has had issues with this?
    ...
  • ...I only ask this because for us it seems to be working just fine and i'm curious that I have not come across it in the documentation.

    Regards,
    Thanos Michos
  • 0
    Certified Lead Developer
    Hey Thanos,

    In the past I have implemented similar approaches to reduce the overhead caused by reevaluation of SAIL components and variables defined in a with() statement. In my experience, the biggest obstacle was accounting for scenarios where a user may select a choice in every drop down, and proceed to change a selection in a randomly selected drop down.
  • Hi thanosm, to the best of my knowledge here goes the answers to your questions:

    Does ANY user interaction with SAIL components cause the whole interface to be reevaluated? - Yes an interaction with a SAIL component causes entire interface (the code present in with() block) to be evaluated.

    For example, changing the value of a radioButton or the value of a textField, would that cause the whole SAIL interface to be reevaluated? - Yes it's true. To reiterate, interaction with any component evaluates the interface again.

    Is anyone aware if the implementation I have just described is not recommended or if anyone has had issues with this? - As far as my experience is considered, some of the users have been following the similar style and this is evident from the uploaded code snippets which I study as part of answering the forum posts.

    I don't think that we can't judge that the approach is recommended or not but so far my expereince is considered I would like to make few statements about the approach you have opted for:

    1. It's true that this kind of approach hasn't been particularly mentioned any where but this kind of approach has been in use since 7.3 indirectly in form of cascading dropdown feature. We have made an similar implementation in our internal projects(built on 7.3) and I further remember that this has been mentioned in one of the SAIL recipes. To reiterate I have seen in some of the code snippets uploaded as part of forum posts.
    2. We need to remember that this kind of implementation may not be possible all the times. This is highly possible when the components are highly inter dependent and less possible when components are completely independent of each other.
    3. The approach you opted for might let you shift some pieces of code from with() (the code being written above the final statement) to a specific component's saveInto area which every other team member might not follow. I would like to suggest to put some comments around this kind of code so that others can follow your intentions and make updates accordingly when a rework is done on the same interface.
    4. One last note I would like to make is, this kind of approach is completely acceptable when components are highly dependent (for example, say cascading dropdown) and at the same trying to opt for the approach in case of non dependent components also leads to the issues which I am not elaborating here as I feel that this elaboration would become out of context.

    Hope the above explanation helps you to some extent.
  • @sikhivahans @joshl Thank you both for your inputs. You have helped a great deal in clearing up the issue of reevaluation.

    @sikhivahans In the first question that you answered you mentioned, in parentheses, the use of a with() function. Just to be clear, my understanding is that even without a with() function present the whole interface is reevaluated when the value of ANY component has been changed. Am I correct?

    The with() function simply gives us the ability to use variables whose value usually depends on other variables outside the with() so as to evaluate a new value for the with() variable every time the whole interface is reevaluated.

    As you have very clearly stated, it all depends on the needs of the interface.
  • @thansom Correct, my statement is with respect to the variables we make use of.