0

Need help with IF / Then Statement in NX script

I'm having trouble getting started with the if then logic with some code I use.

"------------If Then Logic------------";
Need help with If amID = null end, else do below
"------------Core Scripting------------";
let sURL := "http://EXAMPLE:17790/api/externalminers/" + amID + "?key=EXAMPLE";
let response := do as server
http("GET", sURL)
end;
'AM.json' := text(response)

In the above code, I've made two separate areas, the top being where I need help crafting an if then / statement.

Ideally if amID is null, I'd like the button to do nothing or alert "amID is not filled", but if the ID has any value, I'd like to run the code below.

I've tried to port over code from examples but it seems like I'm only addressing one line of the  Core Scripting when I try. If anyone can help me out here, you'll make my Christmas and I'll keep adding to my logic. I've just inserted psuedo code for now to demonstrate what I'd like to do. 

3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Maybe this :

    if amID != null then

    Code...

    end

    (no use of the else)

    Steven 

    Like
  • != means is not null

    Like
    • TNT
    • OregonMines
    • TNT
    • 2 yrs ago
    • Reported - view

    Thank you Steven, it was my trying to include an else that had no function that was breaking it. Love ninox!

    Like
Like Follow
  • 2 yrs agoLast active
  • 3Replies
  • 1273Views