12-13-2012 02:06 AM
You are really in luck. Running from one honey pot to the next one. 🙂
I tried to create an example including all your points.
Option Explicit
Dim myDataStorePlugin : myDataStorePlugin = "ATFX"
Dim myDataStoreParam : myDataStoreParam = "<filename readonly=""yes"">" & replace(CurrentScriptPath & "EarthquakeExample.atfx", "&", "&") & "</filename>"
dim oMyDataStore : set oMyDataStore = Navigator.ConnectDataStoreByParameter(myDataStorePlugin, myDataStoreParam)
dim measurementEntityName : measurementEntityName = oMyDataStore.Model.Entities("aomeasurement").SubTypes(1).Name
dim StartDate : StartDate = CreateTime(2001,1,13,17,33,0,0,0,0).VariantDate
dim EndDate : EndDate = CreateTime(2001,1,13,17,34,0,0,0,0).VariantDate
dim query : set query=oMyDataStore.CreateQuery
query.ReturnType = measurementEntityName
Call query.Conditions.Add(measurementEntityName,"measurement_end",">=",StartDate)
Call query.Conditions.Add(measurementEntityName,"measurement_end","<=",EndDate)
Call oMyDataStore.Search(query)
data.Root.Clear
dim result : for each result in oMyDataStore.Results
' If you call LoadData use nothing or a load parametrization as third parameter. The default parametrization may not fit
dim diademGroup : set diademGroup = navigator.LoadData(result, "Load", nothing)(1)
' if portal is empty LoadData might return the root instead of the loaded group
if diademGroup.IsKindOf(eDataRoot) then set diademGroup = diademGroup.ChannelGroups(1)
dim propItem : for each propItem in result.Properties
if(propItem.Size > 0) then
' attribute is set in ASAM store
select case propItem.DataType
case DataTypeDate
' date time properties return UsiTimeDisp so they have to be assigned by set
dim usiTimeDispVar : set usiTimeDispVar = result.Properties("measurement_begin").Value
' if you need a CDate use
dim cDateVar : cDateVar = usiTimeDispVar.VariantDate
call diademGroup.properties.Add(result.Type & "_" & propItem.Name, usiTimeDispVar)
case else
call diademGroup.properties.Add(result.Type & "_" & propItem.Name, propItem.Value)
end select
end if
next
Next
I attach the running example including the atfx file as a zip.
12-13-2012 07:39 AM
Thanks for being patient with me. This stuff isn't clear in the help file to me. I appreciate all the help you have provided. 🙂