Page 3 of 3
Re: What is the easiest control to use for my project?
Posted: Sat Aug 30, 2014 5:51 pm
by karmacomposer
Klaus,
I just PMd you with the file.
Thanks again.
Mike
Re: What is the easiest control to use for my project?
Posted: Sat Aug 30, 2014 6:51 pm
by jacque
karmacomposer wrote:
OMG!!!!!!!! That's what programming till 4am does to you.
LOL. I always try to break off before 3 AM.
BTW, if you're signed up for the conference streaming, I'm doing a talk on how to use the debugger. It's an invaluable tool and there have been requests on the mailing list for a tutorial on it. Questions about debugging come up here on the forums too, so I figured it would be a good topic. Once you know how to use it, you won't be able to work without it.
Re: What is the easiest control to use for my project?
Posted: Sat Aug 30, 2014 8:50 pm
by bangkok
Code: Select all
set the dgText ["itemPurchased"] of group "dgItems" to tThingBought
This seems wrong.
Look at the definition of dgText.
Code: Select all
http://lessons.runrev.com/m/datagrid/l/7344-data-grid-api
It should be
Code: Select all
set the dgText of group "dgItems" to tThingBought
or
Code: Select all
put true into pFirstLineContainsHeaders
set the dgText[pFirstLineContainsHeaders] of group "dgItems" to tThingBought
Anyway, like Klaus said, everything else looks normal.
So at the end, if nothing shows up in your Datagrid, 2 possible causes :
-your array is empty
-or the key names... of your array do not match the name (not label) of your datagrid's columns
One advice :
-check you arraw (with break point in the debugger) like Klaus said
-if indeed you have a content, then create a new DG, with only 1 or 2 columns, with proper names matching keys name of your array, and try set the dgData.
Re: What is the easiest control to use for my project?
Posted: Sun Aug 31, 2014 5:09 pm
by jacque
For the tax issue, just limit the addition to the cases where it's really a number (no try structure needed this way) :
Code: Select all
if tSalesTax is a number then add tSalesTax to tTotalSalesTax
Re: What is the easiest control to use for my project?
Posted: Sun Aug 31, 2014 5:49 pm
by karmacomposer
jacque wrote:For the tax issue, just limit the addition to the cases where it's really a number (no try structure needed this way) :
Code: Select all
if tSalesTax is a number then add tSalesTax to tTotalSalesTax
Did not work because there are numbers in these strings.
Example of strings that are causing trouble:
KZX9VLWATAXE8
bc81d6e1e9746-a-HTTP/1.1 200 OK
2bb86cd8efa40-a-HTTP/1.1 200 OK
d301c2117b74f-a-HTTP/1.1 200 OK
bce1f2028989e-a-HTTP/1.1 200 OK
425e5cffbe5b1-a-HTTP/1.1 200 OK
d5330af7ef40a-a-HTTP/1.1 200 OK
446ee3c475e60-a-HTTP/1.1 200 OK
All valid numbers are either 0.00, 00.00, 000.00 or 0000.00
They won't go over that. How do I limit this field to ONLY allow two to four numbers, a decimal and then another two numbers?
Mike
Re: What is the easiest control to use for my project?
Posted: Sun Aug 31, 2014 9:34 pm
by jacque
None of those example lines are recognized as numbers by themselves, "bc81d6e1e9746-a-HTTP/1.1 200 OK" isn't a number. But I think you're extracting the second item, based on an item delimiter of "=". In that case, the second item is empty, and LiveCode will translate empty to zero. That shouldn't affect the final value after addition. Are you getting a script error?
You can try "if tSalesTax is a number and tSalesTax is not empty then..." But you shouldn't have to. How exactly does it fail?
Re: What is the easiest control to use for my project? [SOLV
Posted: Sun Sep 07, 2014 2:49 am
by karmacomposer
Thanks to all of you and especially Klaus' help, my code now works and it will be finished in a matter of days.
Any help, however, on how to take a highlighted section of the datagrid and then add up all the data in a column would be a great help.
For example, one column has the sales tax for each sale and the client wants to see what the sales tax was for a 2 week period, so he highlights the rows that amount to 14 days. I would then like to automatically add up all the sales tax numbers in the selected rows and show them in a dedicated field.
Mike