DataGrids - Problems creating scripts
Posted: Thu Aug 15, 2013 10:10 am
Hi
I'm creating an iPad App for our distribution business and have managed to get quite a bit completed but now I'm having problems coding certain areas…if anyone can help please as I'm a designer and not too familiar with coding unless it's simple, having said that I do enjoy a challenge and learning, but I need examples to teach me how to put the scripts together!
Card one of the stack will have a DataGrid with 2 columns, one has a list of addresses serving a particular area (possibly 200 addresses). A single address is selected via a button in col 2 of the DataGrid which takes you to a card which will have the details of that one specific address.
This new card will have a data grid which contains columns as listed below.
The columns would be headed as Leaflets, Date, Amount, Type of Rack, Spinner Units
Leaflet column would be populated with List of customer leaflets (approx 26 different sorts)
"Date" Column will be a Date PickWheel
"Amount" column will be an Option Menu
"Rack Sizes" will be an Option Menu
"Spinner Units" will be a Check Box
I'm happy about creating this with DataGridHelper
But its the saving of the content which is losing me.I have the following script which saves a text file on the desktop in Mac.
on mouseUp
ask file "Save the data :" with "MyFile"
if it is empty then
beep
exit to top
end if
put "file:"&it&".txt" into thePath
--- we get the columns names
put the dgProp[ "column labels" ] of group "Datagrid 1" into theColumnNames
replace cr with tab in theColumnNames
-- with this method, we choose which column we want to save
-- here col1, col2,
put empty into theText
put the dgData of group "Datagrid 1" into theData
put the dgIndexes of group "Datagrid 1" into theIndexes
repeat for each item theIndex in theIndexes
put theData[theIndex]["Leaflets"] &tab&theData[theIndex]["Date"]&tab&theData[theIndex]["Amount"] &tab&theData[theIndex]["Rack Sizes"] &tab&theData[theIndex]["Spinner Units"]& cr after theText
end repeat
put theColumnNames&CR&theText into aTraiter
put aTraiter into URL thePath
answer info "Done"
end mouseUp
This works OK on the desktop, although I don't get the "date"
But when tested in iPad simulator although a message says "Done" I don't know what is happening to the file if anything?
My questions are, how would the scripts be compiled to achieve the questions asked below….
1. How do I write a script to save the DataGrid information to a text file? and also save it on the actual iPad if need be? A clear example would be great!
2. Can I save the information from approx 200 cards each containing their own DataGrid/s with one button click?
3. Can I have more than one DataGrid on each card and save that info as question 2?
4. Can I save the information in the DataGrids for the complete stack in one go?
5. I'd also like a button to reset the columns back to their unselected state in the DataGrids at the end of each week's deliveries.
I hope this is not too much to ask, but without help I'm really stuck.
Thank you
Brian
I'm creating an iPad App for our distribution business and have managed to get quite a bit completed but now I'm having problems coding certain areas…if anyone can help please as I'm a designer and not too familiar with coding unless it's simple, having said that I do enjoy a challenge and learning, but I need examples to teach me how to put the scripts together!
Card one of the stack will have a DataGrid with 2 columns, one has a list of addresses serving a particular area (possibly 200 addresses). A single address is selected via a button in col 2 of the DataGrid which takes you to a card which will have the details of that one specific address.
This new card will have a data grid which contains columns as listed below.
The columns would be headed as Leaflets, Date, Amount, Type of Rack, Spinner Units
Leaflet column would be populated with List of customer leaflets (approx 26 different sorts)
"Date" Column will be a Date PickWheel
"Amount" column will be an Option Menu
"Rack Sizes" will be an Option Menu
"Spinner Units" will be a Check Box
I'm happy about creating this with DataGridHelper
But its the saving of the content which is losing me.I have the following script which saves a text file on the desktop in Mac.
on mouseUp
ask file "Save the data :" with "MyFile"
if it is empty then
beep
exit to top
end if
put "file:"&it&".txt" into thePath
--- we get the columns names
put the dgProp[ "column labels" ] of group "Datagrid 1" into theColumnNames
replace cr with tab in theColumnNames
-- with this method, we choose which column we want to save
-- here col1, col2,
put empty into theText
put the dgData of group "Datagrid 1" into theData
put the dgIndexes of group "Datagrid 1" into theIndexes
repeat for each item theIndex in theIndexes
put theData[theIndex]["Leaflets"] &tab&theData[theIndex]["Date"]&tab&theData[theIndex]["Amount"] &tab&theData[theIndex]["Rack Sizes"] &tab&theData[theIndex]["Spinner Units"]& cr after theText
end repeat
put theColumnNames&CR&theText into aTraiter
put aTraiter into URL thePath
answer info "Done"
end mouseUp
This works OK on the desktop, although I don't get the "date"
But when tested in iPad simulator although a message says "Done" I don't know what is happening to the file if anything?
My questions are, how would the scripts be compiled to achieve the questions asked below….
1. How do I write a script to save the DataGrid information to a text file? and also save it on the actual iPad if need be? A clear example would be great!
2. Can I save the information from approx 200 cards each containing their own DataGrid/s with one button click?
3. Can I have more than one DataGrid on each card and save that info as question 2?
4. Can I save the information in the DataGrids for the complete stack in one go?
5. I'd also like a button to reset the columns back to their unselected state in the DataGrids at the end of each week's deliveries.
I hope this is not too much to ask, but without help I'm really stuck.
Thank you
Brian