Page 1 of 1
Value of subform field.
Posted: Thu May 26, 2022 7:46 pm
by treed
Hello I have a 2 tiered pricing system and need to look up the quantity value to determine the pricing. This is done in a subform grid. The lookup table has a product small order price a min order quantity and a normal price. Right now the price is placed in the form from a lookup of product code after browse.
Screenshot from 2022-05-26 10-41-26.png
What I'm trying to do is something like this:
$lu = nuLookupRecord();
if (#OrdLineQty#<$lu->ProdWholeSaleMinQty)
{
nuSetFormValue('OrdLineRate', $lu->ProdSmWholeSale);}
else {
nuSetFormValue('OrdLineRate', $lu->ProdWholeSale);}
nuSetFormValue('OrdLineDesc', $lu->ProdDesc);
However I can see that hashcookies for subform objects are not available. Any suggestions on how to proceed?
Re: Value of subform field.
Posted: Thu May 26, 2022 9:25 pm
by kev1n
Hi,
Add an onclick event to your lookup object to set a Hash Cookie that can be used in After Browse:
Code: Select all
var qty = nuSubformRowObject(event.target.parentElement.id, 'OrdLineQty').val();
nuSetProperty('OrdLineQty', qty);
Re: Value of subform field.
Posted: Thu May 26, 2022 10:50 pm
by treed
Thank you!
Re: Value of subform field.
Posted: Thu Jun 09, 2022 12:22 am
by treed
There seems to be a browser issue in Brave (my preferred browser), but things work fine in FireFox. What I'm finding is that the property is not always set. I'm seeing this through the console.
Screenshot from 2022-06-08 15-19-09.png
I'm assuming that the error is caused by the above, if not please let me know. FF reports no errors. Any idea how to resolve this?
Re: Value of subform field.
Posted: Thu Jun 09, 2022 5:31 am
by kev1n
This is not an error but an "improvement issue" that is caused by the external library Google chart.
I tried to replicate your issue using Brave but was not able to do so.
What I did was set a Hash Cookie with nuSetProperty('#OrdLineQty#','someting') in a lookup's onclick event.
In the After Browse event I output it with nuDebug('#OrdLineQty#');
What you could do is a console.log() after setting the Hash Cookie to output its value to the console. This is to watch if is actually being set.
Code: Select all
nuSetProperty('OrdLineQty', qty);
console.log('OrdLineQty: ', qty);
Re: Value of subform field.
Posted: Thu Jun 09, 2022 5:11 pm
by treed
I did set a console.log. When it was set, things it worked, when it wasn't it didn't. It seems to work randomly mainly on new records. This is Brave on Ubuntu 22.04.
Re: Value of subform field.
Posted: Fri Jun 10, 2022 8:10 pm
by treed
Got an update to Brave yesterday and it seems to work fine now.