0

Passing null for a parameter of record type to custom functions

Hello Friends,

I did a lot of finding on this and finally resolved it by chance (couldn't find anything in the forum or on internet) that in order to pass a null parameter (that is expected to be of type record), we cannot simply pass "null". We have to actually create a temporary variable with value "this", then make it null and then pass it to the function.

"-- create a temporary reference to a record";
let nullRec := this;

"-- make the reference null";
nullRec = null;

"-- pass null parameter to the function";
let pmtData := parseJSON(validateBillPayments(nullRec));

text(pmtData.message)

if I write the above function call as:

let pmtData := parseJSON(validatePayments(null));

OR

let pmtData := parseJSON(validatePayments(record(null)));

OR

let pmtData := parseJSON(validatePayments(number(null)));

I get an error "Expected node in the function call, passed void"

 

Is there a better way/syntax/code to achieve the above solution?? If no, then don't understand why is Ninox scripting so weird and there is such depth of documentation !!

 

Thanks,

Vermaji

-------------------------------

Reply

null

Content aside

  • 16 hrs agoLast active
  • 6Views
  • 1 Following