If true value with multiple fields

Hi, I am trying to get 3 fields if the condition is true but it doesn't seem to be working with brackets.. Can somebody pls shed some light. E.g. if ( condition=true, (field1 field2 , field3), "false field)

OriginalPostID-272292

  Discussion posts and replies are publicly visible

  • @geetp, try using curly brackets. E.g. if(condition =true, {field1, field2 , field3}, field4)
  • 0
    Certified Lead Developer
    over 6 years ago
    @geetp can you share the SAIL code, if the suggestion mention by @brindas did not work for you, but as per my understanding using braces should work as suggested by @brindas too, i think the issue was, instead of using {} you were trying to use ()
  • Many thanks for your response. Being a newbie I really appreciate your help. I shall try and give it a go.. I have another q- hope you can help on that too. I have created a quick app and I have a field called overdue- in the value- I have defined if statement ( if today> ri!input , " not overdue","overdue"). Although it works well in interface to give correct result, doesn't work in tempo. I am saving the value in ri!overdue. Can you pls shed some light on where am I gng wrong pls
  • Possible things:
    1. Assume that if(fn!today()>ri!input,"not overdue","overdue") it is an expression rule that takes an rule input i.e "input", if so please check the in SAIL are u passing ri!overdue while calling the above rule.
    2. if you are checking inside SAIL code only then u need to check with ri!overdue instead of ri!input
  • 0
    Certified Lead Developer
    over 6 years ago
    @geetp is there any possibility of having null values for ri!input at initial or in any case, if yes, then first try to handle the null before doing comparison as attached below


    isEmpty Expression Rule
    =======================================
    if(
    or(
    isnull(
    ri!input
    ),
    len(ri!input)<1,
    length(ri!input)<1
    ),
    true(),
    false()
    )
    =======================================

    here ri!input is of Any Type


    Interface
    =================================
    if(
    rule!isEmpty(ri!input),
    {},
    today > ri!input
    )
    ==============================

    also try printing this above statement along with any label of the Form and then Test, hope this work
  • Thanks.. This is what I have got.

    a!textField(
    label: "Overdue?",
    labelPosition: if(ri!readOnly, "ADJACENT", "ABOVE"),
    instructions: if(ri!readOnly, "", ""),
    helpTooltip: if(ri!readOnly, "", ""),
    placeholder: if(ri!readOnly, "", ""),
    value: if(
    today () >workday(ri!record.requestReceivedDate,5),
    "Overdue",
    "Not Overdue"),
    saveInto:ri!record.overdue,
    required: false,
    readOnly: true,
    validations: if(
    today () >workday(ri!record.requestReceivedDate,5),
    "Overdue",
    "Not Overdue"
    )
    )

    interface inputs- CDT record.requestreceiveddate & record.overdue. Haven't defined any local variable for overdue
  • 0
    Certified Lead Developer
    over 6 years ago
    @geetp as you are using workday function, so make sure that the input for this function should never have the null value either at parameter1 or at parameter2
  • 0
    Certified Lead Developer
    over 6 years ago
    Apart from this everything seems to be good, i think here null is causing the issue. For debugging purpose, try replacing ri!record.requestReceivedDate with today() function at both the place
  • The result is good in interface but when I try checking the value in variable overdue- it doesn't seem to be saving.. Is my saveinto syntax correct?
  • 0
    Certified Lead Developer
    over 6 years ago
    @geetp if ri!record.overdue is of type Text then yes its Correct