Prevent refresh on local variable based on queryentity()

Certified Associate Developer

Hi All,

I have a local variable defined within load() which retrieves data from one of the table using a!queryentity() .

local!data: rule!getAllData(id)

Whenever there is an insert or update happens in the table , local!data pulls the new values on performing a refresh of the page from the browser .

My requirement is that i dont want to query the table again even though i refresh the page from the browser . Basically i want to retrieve the data from database only once when the task is generated . 

Please can you help me with this problem.

Thanks in advance .

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    i dont want to query the table again even though i refresh the page from the browser .

    The only way to do this is to query the data in the process prior to the task and pass the queried data into the task as a rule input - fairly easy to do.

    Also: why are you using load()?  Are you really on a 3+ year old Appian installation?

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    Hi Mike - Thankyou for your response . 

    If its the only way then what should be my approach to handle all the active tasks or instances in PROD ?  I can only think of closing all the tasks before this change goes to production . Is there any alternative ? 

    Also, why m I using load() is because these applications have been developed way long back and I agree its not fully updated with latest features Slight smile definitely we have to do this in future .

  • +1
    Certified Lead Developer
    in reply to Ash
    Also, why m I using load() is because these applications have been developed way long back

    That makes sense - just checking.  I suggest you prioritize changing this over to a!localVariables as soon as you can, though.

    what should be my approach to handle all the active tasks or instances in PROD

    That highly depends on what you hope to happen with active instances.  You won't be (easily) able to amend active instances to query the data prior to the task, so any changes you make should ensure that active tasks can continue working at least as they currently do.  New instances can get your new desired behavior.  This could be accomplished by editing the interface to check whether a value was passed in from the process, and if so, the interface uses that value, and if not, then it does the query as it does currently.  This would allow you to safely add the functionality to pass the data in from the process but have existing instances of the task continue to work as-is.

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    Hi Mike - Thankyou for your suggestion . While i am trying to make these changes  , i have one query - 

    I have a form with editable grid which helps user to create or update questions(question id is primary key here), user can add or update new questions and click on "Next" button which again displays a form where user can enter question Options/details for those questions which is created on first page.

    Question(Parent table) - PK- questionId

    Question Option(Child table) - FK - questionId

    Based on current design when user click on "Next" button , we are using writeToDataStoreEntity and writes questionId into DB and then in the next page we make DB call and create Question Option for those questionIds.

    Now i want to change the design and make sure that whenever user click on "Submit" button (which is on the second form) then only i want to write the details into DB . With this approach i wont be having questionId when i go to the next page so my idea is to generate unique question ids in the SAIL form when user click on Next button and make sure those uniquely generated id's are not present in DB currently . 

    How this can be done from SAIL ? 

  • 0
    Appian Employee
    in reply to Ash

    You have two options for this design pattern:

    1. Create multiple task forms and activity chain them together. To do this correctly, you will need to pass the results from your first form to the second form. See this example.
    2. Create a SAIL wizard. This would use a single form that dynamically changes by displaying different sections based on a button click. See this example.

    In either case, it shouldn't be necessary to query twice because you should be using the results of your first query throughout your process or form.