I have a spreadsheet which I read in and select a row at random.
My aim is to use the column headers as the text to search for on the screen, and the row data which it has selected as the input for the field.
All this mostly works fine, however I need to iterate from left to right through the data (As is - on spreadsheet) because certain fields have to be completed first in order to populate data for other drop down boxes.
But when I use the > Put the records of MyExcelFile into MyData
The data is sorted into alphaNumerical order and not kept in the same order as the spreadsheet.
This now means all the data is out of order and I cannot use it.
This is the code i have:
Put () into FinalList
Put () into GLOBAL ExtractedRowData
Set MyExcelFile to PathOfDataFile
Put the records of MyExcelFile into MyData
Repeat with each item DataRow of MyData
if DataRow.("Enable Row (Y/N)") = "Y" then
insert DataRow into FinalList
end if
End repeat
Put the number of items in FinalList into x
if ArbitraryRowNumber = "Random" then
Set ExtractedRowDataTEMP to (item random(x) of FinalList)
repeat with each item x of keys(ExtractedRowDataTEMP)
if property (x) of ExtractedRowDataTEMP is not empty then insert x & ":" & property (x) of ExtractedRowDataTEMP into GLOBAL ExtractedRowData
end repeat
else
Try
Set ExtractedRowDataTEMP to (item ArbitraryRowNumber of FinalList)
repeat with each item x of keys(ExtractedRowDataTEMP)
if property (x) of ExtractedRowDataTEMP is not empty then insert x & ":" & property (x) of ExtractedRowDataTEMP into GLOBAL ExtractedRowData
end repeat
Catch theException
_20_Global_Errors.DAIWrongValue "DAI Passed Value > "&ArbitraryRowNumber&" through to CBO_DataRetrieval. - Number of items available: "&number of items in FinalList
End try
end if
Can anyone please help?