Im building arrays by reading all the child records related to a father record
This is the code I used (I simplified to make it more understable)
while($prCont < $prContTotal,
$prLineId = array\at($prChildRecordsIds, $prCont); // Recovers from the Multiple Link array each id
// Retrieve a couple fields from Child Records
$prProductId = record\attribute('ChildRecord', $prLineId, 'productId');
$prTotalTax = record\attribute('ChildRecord', $prLineId, 'totalTax');
//Build the arrays
$prWooOLProds = array\push($prWooOLProds, $prProductId);
$prWooOLTotalTaxes = array\push($prWooNewOLTotalTaxes, $prTotalTax);
$prCont = $prCont + 1);
And this code works perfectly for the $prProductId field but not for $prTotalTax.
Not sure what happens.
Seems that for $prTotalTax it skips all the pushes except the last one
This issue seems that is related with the type of content of the field. When the content is a string (i.e xyz) or an integer (i.e 1) it works properly, but when its a decimal content (like 2.28 or 7.11) it doesn't work.
I have tried to force it by using a string\concatenate($prTotalTax) but it didn't work.
As well 'totalTax' is defined as text field in the ChildRecord table. But seems that it is related with the content itself
I have solved with the following workaround:
Instead of a push I did a concatenate with a comma between each addition.
When finished I did a string\split
And that made the trick.
Nevertheless I thought you should know this issue.
This is the code I used (I simplified to make it more understable)
while($prCont < $prContTotal,
$prLineId = array\at($prChildRecordsIds, $prCont); // Recovers from the Multiple Link array each id
// Retrieve a couple fields from Child Records
$prProductId = record\attribute('ChildRecord', $prLineId, 'productId');
$prTotalTax = record\attribute('ChildRecord', $prLineId, 'totalTax');
//Build the arrays
$prWooOLProds = array\push($prWooOLProds, $prProductId);
$prWooOLTotalTaxes = array\push($prWooNewOLTotalTaxes, $prTotalTax);
$prCont = $prCont + 1);
And this code works perfectly for the $prProductId field but not for $prTotalTax.
Not sure what happens.
Seems that for $prTotalTax it skips all the pushes except the last one
This issue seems that is related with the type of content of the field. When the content is a string (i.e xyz) or an integer (i.e 1) it works properly, but when its a decimal content (like 2.28 or 7.11) it doesn't work.
I have tried to force it by using a string\concatenate($prTotalTax) but it didn't work.
As well 'totalTax' is defined as text field in the ChildRecord table. But seems that it is related with the content itself
I have solved with the following workaround:
Instead of a push I did a concatenate with a comma between each addition.
When finished I did a string\split
And that made the trick.
Nevertheless I thought you should know this issue.
Comment