Skip to main content
January 30, 2024
Question

How can we assign a boolean value to null

  • January 30, 2024
  • 11 replies
  • 0 views

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
    January 30, 2024

    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)

    January 31, 2024

    Yeah , I am using into the saveinto of button widget

    stefanhelzle0001
    Brainy
    January 30, 2024

    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
    January 30, 2024

    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
    January 30, 2024

    [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
    February 5, 2024

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