How to add a check for if a parse is null?



  • Hi, so I asked this in the SB but you said to open a thread so here I am 🙂 I'm not sure if this is a stupid question but oh well.

    So basically I have created a Capture for "last four digits" of an account. But however if the account does not have a "last four digits" it is just empty. So if I capture the last for digits of the account the parse would look like this: "LAST FOUR" "9999" but if its empty it'll just be "LAST FOUR" " ". So what I am asking is, is it possible to add a bit of loliscript to check if a capture is null? I believe the pseudo code would be something like this:

    IF CAP "LAST FOUR" isNull
    SET "<STATUS>" FREE
    ELSE
    SET "<STATUS>" Success
    ENDIF

    I can't use a DoesNotContain because there are 10,000 different possible combinations.
    I am so sorry if this doesn't make sense I am not too sure how to really explain it..


  • Admin

    The syntax of your SET command is wrong. Also you want to do this:

    IF "<MYVAR>" EqualTo ""
    SET STATUS CUSTOM "Free"
    ELSE
    SET STATUS SUCCESS
    ENDIF
    

    Another way would be to untick the "create empty" checkbox in the parse block and the IF statement will become

    IF "<MYVAR>" Exists
    SET STATUS SUCCESS
    ELSE
    SET STATUS CUSTOM "Free"
    ENDIF
    

    which in my opinion is more readable.



  • @Ruri Ahhh I see! Thank you so much :))))


Log in to reply