Filed value saving issue

Hi 

Below are two codes where first one is getting save in rule input variable but on display validation nothing is displaying .

On second code i have added 'value' syntax conditionally. Where display value will come on true condition.But after adding this nothing is getting save in rule input variable.

Why issue is coming only after adding value syntax. As i need that to display value on true condition. Kindly help me where is the exact issue.

1.

 a!paragraphField(
label: "Sample Field",
disabled: if(rule!APN_isBlank(local!flag),false,true),
saveInto: {
a!save(ri!requsetData.sampleField,
if(rule!APN_isBlank(local!tempChangeFlag),
{ri!requsetData.sampleField},"Need to Display if flag is true")
),
},

),  

2.

a!paragraphField(
label: "Sample Field",
value: if(rule!APN_isBlank(local!flag),"","Need to Display if flag is true"),
disabled: if(rule!APN_isBlank(local!flag),false,true),
saveInto: {
a!save(ri!requsetData.sampleField,
if(rule!APN_isBlank(local!tempChangeFlag),
{ri!requsetData.sampleField},"Need to Display if flag is true")
),
},

),

  Discussion posts and replies are publicly visible

  • Hi Sauravk,

    On your first point , you enter any value in the text box it always check for the validation of that particular field first , if there is no validation matches then it will save the values into variable but in your case your looking for that in reverse order .  

  • plz suggest correct approach. Main goal is to display text on true condition n that should be save in rule input variable. But if i remove "Value" syntex then its working fine. Plz correct my code if you have any idea about the issue.

  • 0
    Certified Lead Developer

    I'm very unclear on what you're actually trying to do in either of these examples.  In both cases, the user's input value to the paragraph fields will never be displayed: in the first example you have no value: parameter set at all, and in the second example your value parameter would never lead to the saved data actually being displayed.

    My overall suggestion with this and all other SAIL issues would be, you should try to thoroughly learn what the core functionality actually does before doing something more advanced.  I would advise that you create a sandbox interface and start out with just a basic paragraph field that does a basic saveInto and displays its own value (the standard use case), then make step-by-step changes to that making sure it still works with every iterative change.  In this manner you will likely be able to figure out the answer to your use case on your own - though if you're still stuck please feel free to post more replies here (preferably with updated code snippets posted in Code Boxes using the "Insert -> Code" functionality).

    Here's a super basic example to start with:

    load(
      local!paragraphValue: null(),
      
      a!paragraphField(
        label: "Sample Field",
        value: local!paragraphValue,
        saveInto: {
          a!save(
            local!paragraphValue,
            upper(save!value)
          )
        }
      )
    )

  •  Below line of code is making this code to display value in case of false.

    value: if(rule!APN_isBlank(local!flag),"","Need to Display if flag is true"),

    Anyways thanks for your so call nice suggestion.

  • 0
    Certified Lead Developer
    in reply to sauravk
    Below line of code is making this code to display value in case of false.

    I'm not sure what you mean by this - because the code doesn't do what you seem to be saying.  This code snippet will cause the paragraph field to display a value of "Need to Display if flag is true" if local!flag has any value at all, and if local!flag is null, then instead it will display "" (i.e. blank). 

    Configured this way, the paragraph field will never display what the user has typed into it, if that's your intention at any point.

  • Yes you are getting correct. But by adding this "value" syntax 

    saveInto: {
    a!save(ri!requsetData.sampleField,
    if(rule!APN_isBlank(local!tempChangeFlag),
    {ri!requsetData.sampleField},"Need to Display if flag is true")
    ), 

    above code is not working. Due to that this  "Need to Display if flag is true" text is not getting save.

    There is one checkbox on my interface page which is denoting flag. On selection of that flag value will change. I hope now you understood what i expected.

  • 0
    Certified Lead Developer
    in reply to sauravk
    On selection of that flag value will change.

    Maybe I understand now - so if you're hoping that the value saved into ri!requestData.sampleField changes when the checkbox is changed, then you should add an a!save() to the saveInto array of your Checkbox field.

    Try this revised example code and see if it gives you any further ideas:

    load(
      local!paragraphValue: null(),
      local!checkboxValue: false(),
      
      a!sectionLayout(
        contents: {
          a!paragraphField(
            label: "Sample Field",
            value: local!paragraphValue,
            disabled: if(
              local!checkboxValue = true(),
              true(),
              false()
            ),
            saveInto: {
              a!save(
                local!paragraphValue,
                upper(save!value)
              )
            }
          ),
          a!radioButtonField(
            label: "T/F",
            choiceLabels: {"True", "False"},
            choiceValues: {true(), false()},
            value: local!checkboxValue,
            saveInto: {
              local!checkboxValue,
              a!save(
                local!paragraphValue,
                if(
                  save!value = true(),
                  "Need to display if flag is true",
                  local!paragraphValue
                )
              )
            }
          )
        }
      )
    )

  • Why do we need to modify checkbox field. This checkbox is getting use on most of columns. I need to do at paragraph field only.

    Why its not taking very straight forward condition.

  • 0
    Certified Lead Developer
    in reply to sauravk

    If you're hoping for the actual stored value to be changed when the value of the checkbox changes, then you need to put in the necessary code in the saveInto of the checkbox. 

    If your intention is for some other change to happen, then please clarify a bit more for me what exactly you're hoping to accomplish since I'm still not quite understanding.

  • Then how this is working.

    saveInto: {
    a!save(ri!requsetData.sampleField,
    if(rule!APN_isBlank(local!tempChangeFlag),
    {ri!requsetData.sampleField},"Need to Display if flag is true")
    ),

    That i am not putting in checkbox.

    If i remove this "value" syntax then it is getting save properly and changing also on change of checkbox. If its working properly then why giving issue by adding "Value" syntax. I add this because i want to show what is going to be save after checking checkbox. because it is going to be  auto populate on selection of checkbox.