Dealing with a simple array (sent by POST)

mardi 13 janvier 2015

Hi,



I am sending from my Application to MIRTH an array with samples IDs.



From my Application:



App::import('Core', 'HttpSocket');

$HttpSocket = new HttpSocket();

$results = $HttpSocket->post('http://xxx.x.x.x:yyyy/new_sample/', array('sendAp' => 'LINK',

'sendFac' => 'HOSPITAL',

'recAp' => 'DEP',

'recFac' => 'SYS',

'PID' => $pat_id['MirthLog']['rgh'],

'pName' => $pat_name['MirthLog']['nome'],

'pBirth' => $pat_bir['MirthLog']['nasc'],

'pGend' => 'F',

'bcode' => $sample, // array with samples ID***

'ncode' => $n_amostra, // number of samples

'orcID' => $exam_id['MirthLog']['codigo_coleta'],

'sender' => 'APPLIC'));



I am getting all this parameters in MIRTH, except the array "bcode"



From MIRTH side:



//NOT WORKING - empty array

var barCode = sourceMap.get('parameters').get('bcode');



// WORKS WHEN I GET ELEMENTS INDIVIDUALLY

var barCode0 = sourceMap.get('parameters').get('bcode[0]');

var barCode1 = sourceMap.get('parameters').get('bcode[0]');



// NOT WORKING USING FOR - EMPTY ARRAY

var barCode = [];

var nCode = sourceMap.get('parameters').get('ncode'); // number of samples

for (var i = 0; i < nCode; i++){

var i2=i.toString();

barCode[i] = sourceMap.get('parameters').get('bcode[i2]'); // SPM (samples)

}



What is wrong???

Sorry, for this basic question, but I got stuck here since yesterday.



Thanks a lot.



Henrique Amaral





Dealing with a simple array (sent by POST)

0 commentaires:

Enregistrer un commentaire