match data from database
Posted: Wed Dec 11, 2013 9:07 pm
hi guys. 
question is...
i have database with row like this in existing datagrid1 (sqlite database)
and here is the xml file
i want to match the current system date(month-day) with (month+day) from the xml file and after with database first_name
i have the xml file and i pass the data to array and then to datagrid2 (always unicode data).
i do not mind if i get it from xml or the datagrid,i am looking the easy way for now to learn it..
thannk you 

question is...
i have database with row like this in existing datagrid1 (sqlite database)
Code: Select all
customer_id
first_name
last_name
Code: Select all
<name_day>
<Onomastikes>
<Month>4</Month>
<Day>23</Day>
<Name> George </Name>
i have the xml file and i pass the data to array and then to datagrid2 (always unicode data).
i do not mind if i get it from xml or the datagrid,i am looking the easy way for now to learn it..

Code: Select all
on mouseUp
set the itemDelimiter to slash
local tPreferencesFile
put item 1 to -2 of the effective filename of this stack & "/birthdays.xml" into mypath
--set the itemDelimiter to comma
# Read the preferences data from the file into a variable. Always check for the result when reading files
# as its possible that the file may have been deleted or moved.
local tPreferencesData, tResult
put url ("file:" & mypath) into tPreferencesData
put the result into tResult
if tResult is not empty then
answer error "Failed to read preferences file at location: " & mypath
return empty
end if
put tPreferencesData into theXML
replace cr with empty in theXML
-- Convert xml to array. Store data in array as UTF8.
put ConvertXMLToArray(theXML, "UTF-8") into theArray -- handler in RevOnline stack
-- Convert to an array that can be assigned to the dgData of a Data Grid (numerically indexed).
put SortArrayKeysWithXMLOrdering(theArray["birthdays"]) into theKeys -- handler in RevOnline stack
put 0 into i
repeat for each line theKey in theKeys
add 1 to i
put theArray["birthdays"][theKey] into theData[i]
end repeat
set the dgdata of group "datagrid1" to theData
--breakpoint -- check values of arrays in debugger
end mouseUp
