Skip to main content
New Participant
Jan 30, 2024 1:14 PM UTC
Question

How can we assign a boolean value to null

if the outageEligible (boolean) is false , then I need to null the value for outage(boolean) 

if(rule!GBL_isnull(ri!outageEligible,false()) , a!save(ri!ouage,null(), a!save(null(),null())) 

above is the code , I am using. But it is not working 

    11 replies

    konduruc733182
    Inspiring
    Jan 30, 2024 1:19 PM UTC

    Hello [mention:f17715bf2b624e8ab11bc56a325be6dc:e9ed411860ed4f2ba0265705b8793d05] 

    a!save(ri!ouage,null(), a!save(null(),null())) 

    Is your rule input named the same? Why do you have a second a!save(null(),null()) which does not make any sense.

    Also can you share your code properly and the button widget code.(Hope you are using this logic in a saveInto parameter)

    New Participant
    Jan 31, 2024 11:38 AM UTC

    Yeah , I am using into the saveinto of button widget

    stefanhelzle0001
    Brainy
    Jan 30, 2024 1:19 PM UTC

    I tried to turn your code into a more readable version.

    if(
      rule!GBL_isnull(ri!outageEligible,false()),
      a!save(
        target: ri!ouage,
        value: null()
      ),
      a!save(
        target: null(),
        value: null()
      )
    )

    Not sure what you are trying to do here, or where this code snippet is used.

    Maybe something like this might work better:

    if(
      rule!GBL_isnull(ri!outageEligible,false()),
      a!save(
        target: ri!ouage,
        value: null()
      ),
      {}
    )

    harshm4411
    Participating Frequently
    Jan 30, 2024 1:29 PM UTC

    Hey,

    a!save( target, value)

    In interface saveInto parameters, updates the target with the given value. Use a!save for each item that you want to modify or alter in a saveInto parameter. This function has no effect when called outside of a component (saveInto parameter).

    According to your question, you can give this a try based on my understanding:

    If outageEligible is false, save null in the outage rule input; otherwise, not

    if(or(ri!outageEligible)=false,a!save(ri!outage,null),{})

    harshitb6843
    Brainy
    Jan 30, 2024 1:34 PM UTC

    [mention:7f7c3545bcbe47119ac428c885b27f95:e9ed411860ed4f2ba0265705b8793d05] 

    In your code, you are comparing a boolean with a boolean. 

    Instead, it could be further simplified as 

    if(
      or(ri!outageEligible),
      {},
      a!save(ri!outage, null)
    )

    abhayd3663
    Brainy
    Feb 5, 2024 7:35 PM UTC

    if(
      ri!outageEligible,
      {},
      a!save(ri!outage, null)
    )