patrick:
Hello Lee,
probably the easiest is if you tell us
- how your table looks like
- what form you are using (what table is it based on)
- how the calculation looks like and how it is called
It does look like you are missing something minor probably. Everybody works with getRecord() and everybody has calcs that work. So if you tell us more, I am sure we can help you out. If you write “record caused a syntax record” it sounds weird, because nothing seems wrong in your code. So either you have no foundset, your form is based on a different table or something else…
Patrick:
This is a simple table. Basic check records. I have a field that is has a full two part description of the Payment Type, payment_type_full, ie. “Medical:Hospital”, I have a Calculated field that breaks this up into it’s two pieces for Report summarization: payment_type_c and payment_subtype_c. Which are calculated values. Here’s the calculation for the payment_type_c field:
if(payment_type_full)
{
return utils.stringMiddle(payment_type_full, 1, utils.stringPosition(payment_type_full, ‘:’,1, 1)-1);
}
else
{
return ‘NOT VALID’;
}
If I MANUALLY edit Payment_Type_Full, the value in payment_type_c updates. I have not been able to get it to update any other way. Here’s the last code I tried:
for ( var i = 0 ; i <=
controller.getMaxRecordIndex() ; i++ )
{
controller.recordIndex = i;
forms.payments.payment_type_c;
}
buttonresult =
plugins.dialogs.showInputDialog(“test”);
It scrolls through the records, and shows me the dialog, but nothing else happens. Here’s my other shot:
var temp = “”;
for ( var i = 0 ; i <=
controller.getMaxRecordIndex() ; i++ )
{
controller.recordIndex = i;
forms.payments.old_payment_recnum.enabled = true;
forms.payments.old_payment_recnum = 1;
temp = forms.payments.payment_type_full;
forms.payment_type_full=‘NA’;
forms.payment_type_full = temp;
forms.payments.payment_type_c=utils.stringMiddle(payment_type_full, 1, utils.stringPosition(payment_type_full, ‘:’,1, 1)-1);
forms.payments.controller.saveData();
}
buttonresult =
plugins.dialogs.showInputDialog(“test”);
This errors on the line where I try to set the value to ‘NA’ with this error:
“Can’t put in a locked scope, name: payment_type_full, value: NA”
I don’t know why this error is occurring or what it means.
Not sure if that helps, but that’s what I’ve been trying.
Regards,
Lee