result of calculation stored in a datagrid, extracted as zero
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
result of calculation stored in a datagrid, extracted as zero
Hi,
I'm storing customer invoices in a datagrid. On some invoices, subject to a Prompt Payment Discount, is an advisory line of text - 'Pay only £304.88 within 14 days.' where the sum 304.88 is from a field, the result of a calculation, but 14 is from a field, but not the result of a calculation. The datagrid saves both figures in the line of text.
The problem arises when I recover the customer invoice (by invoice number); the line of text shows as 'Pay only £0.00 within 14 days.'.
Is it possible to set the line of text as text only to possibly avoid this problem ?
I'm storing customer invoices in a datagrid. On some invoices, subject to a Prompt Payment Discount, is an advisory line of text - 'Pay only £304.88 within 14 days.' where the sum 304.88 is from a field, the result of a calculation, but 14 is from a field, but not the result of a calculation. The datagrid saves both figures in the line of text.
The problem arises when I recover the customer invoice (by invoice number); the line of text shows as 'Pay only £0.00 within 14 days.'.
Is it possible to set the line of text as text only to possibly avoid this problem ?
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: result of calculation stored in a datagrid, extracted as zero
Is your end result composed of: £ + number + text + number + text ?
Or, is it composed of £344 + text + number + text ?
Or, is it composed of £344 + text + number + text ?
Re: result of calculation stored in a datagrid, extracted as zero
Hi Richmond62,
code]put "Pay only £" & fld "discountedtotal" of cd "doc2" & " within " & fld "days" of cd "doc2" & " days." into fld "vn5" of cd "doc2"[/code]
is the code for the line of text.
Field "discountedTotal" is the result of a calculation.
Regards,
CAsba.
code]put "Pay only £" & fld "discountedtotal" of cd "doc2" & " within " & fld "days" of cd "doc2" & " days." into fld "vn5" of cd "doc2"[/code]
is the code for the line of text.
Field "discountedTotal" is the result of a calculation.
Regards,
CAsba.
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: result of calculation stored in a datagrid, extracted as zero
I presume you have checked what is going into fld "discountedtotal".
I also assume that BEFORE this:
the calculation to dump a number into fld "discountedtotal" has already been performed.
I also assume that BEFORE this:
Code: Select all
put "Pay only £" & fld "discountedtotal" of cd "doc2" & " within " & fld "days" of cd "doc2" & " days." into fld "vn5" of cd "doc2"
Re: result of calculation stored in a datagrid, extracted as zero
Yes, your assumption is correct.
The line of text works ok when originally put onto the invoice; it is only when it is recovered from the datagrid that the problem occurs.
The line of text works ok when originally put onto the invoice; it is only when it is recovered from the datagrid that the problem occurs.
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: result of calculation stored in a datagrid, extracted as zero
Try using a table field instead of a datagrid.
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: result of calculation stored in a datagrid, extracted as zero
The issue cannot be what sort of control CAsba is using, it has to be a code issue. The line of code itself, modified for use in a test stack I made, works fine.
Since there are no calculations here to throw an error, there is something else going on.
Craig
Since there are no calculations here to throw an error, there is something else going on.
Craig
Re: result of calculation stored in a datagrid, extracted as zero
Is there a way of manipulating the field "discountedtotal" so that there is no trace of it being a result of a calculation, something like...'set as text fld "discountedtotal" or similar ?
Re: result of calculation stored in a datagrid, extracted as zero
What I would suggest is that you store the invoice amount in its own key/column (this does need to be visible).
If you want to show the text
That way you always have easy access to the invoice amount but you only show the full sentence, if that makes sense?
If you want to show the text
you could show that by constructing the sentence in the fillinData handler of the row/column behaviour of the visible column, which would be for decoration only, because the amount and interval are stored in hidden keys.Pay <invoiceAmount> within <intervalDays> days
That way you always have easy access to the invoice amount but you only show the full sentence, if that makes sense?
Re: result of calculation stored in a datagrid, extracted as zero
Hi everyone,
First thing I have to say is "sorry" for wasting your time (again!); I discovered what was causing the prob - some troublesooting coding that I hadn't deleted got in the way. I'm really full of remorse for not properly checking before I burst into print on the forum. As it turned out, there was a positive outcome.
Once again, guys, sorry to take up your valuable time and mental energy.
CAsba
First thing I have to say is "sorry" for wasting your time (again!); I discovered what was causing the prob - some troublesooting coding that I hadn't deleted got in the way. I'm really full of remorse for not properly checking before I burst into print on the forum. As it turned out, there was a positive outcome.
Once again, guys, sorry to take up your valuable time and mental energy.
CAsba
-
- VIP Livecode Opensource Backer
- Posts: 7241
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: result of calculation stored in a datagrid, extracted as zero
No problem, I've done much worse. It's embarrassing. I think we've all been there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com