Page 1 of 1

passing an array of data as a parameter

Posted: Sat Feb 01, 2014 11:21 pm
by jalz
Hi Guys,
I'm playing with data grids, and I want to take a line of data and pass that data to another command in another stack called CustomerContactEdit. I can seem to pass a single parameter such as in this case FirstName but what I can't seem to pass is the entire tRecordA and process

Code: Select all

on EditRecord pLineNumber
   local tLine, tRecordA, tRecordId

   put the dgDataOfLine[pLineNumber] of me into tRecordA
   
   put tRecordA["firstname"] into tFirstName
   answer tFirstName 
   
   --CustomerContactEdit tFirstName   
   CustomerContactEdit tRecordA
end EditRecord

-- this code is in another stack

command CustomerContactEdit pRecordA
   
   put tRecordA["contactID"] into tContact
   put tRecordA["firstname"] into tFirstname
   put tRecordA["lastname"] into tSurname
   
   answer tFirstname
   
   return the result
end CustomerContactEdit

Anyone advise me how to get the data that belongs to the entire record across to the command?

Thanks

Jalz

Re: passing an array of data as a parameter

Posted: Sun Feb 02, 2014 12:06 am
by dunbarx
Hi.

An array will come over just fine as a passed parameter.

What happens if you step through the code? I made a modified test of your script with a DG and a button, and everything works as advertised.

Craig Newman

Re: passing an array of data as a parameter

Posted: Sun Feb 02, 2014 12:11 am
by dunbarx
Hi again,

I stopped my test a little early. Check out your "CustomerContactEdit " handler, you pass the array to the handler through the local variable "pRecordA". But you then use the array variable "tRecordA". Typo?

Craig Newman

Re: passing an array of data as a parameter

Posted: Sun Feb 02, 2014 12:29 am
by jalz
Hi Craig,

Yes Typo, I've changed everything to pRecordA now, but still not working. Whats the best way to step through code. I presume I need to turn on Script Debug mode, but haven't figured out how do I get to step through the actual code?

Thanks

Re: passing an array of data as a parameter

Posted: Sun Feb 02, 2014 12:54 am
by jalz
Hi Craig,

Got it working and also walked through the script debugger. Thanks for the tip and heads up :)

Jalz