DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create dataplugin using .csv file?

Solved!
Go to solution

Hello Brad,

 

Thank you for reply,

 

Below is the code ..Here the table structure is diff then priveous .In this table i have 64 colums.

Now i want to pass data to 3rd party layer , then the 3rd aprty layer will insert into table

 

here is the table  :- 64 table columns

 

create 64tablename

(

 

"ID" NUMBER NOT NULL ENABLE,
 "NAME" VARCHAR2(254 CHAR) NOT NULL ENABLE, 
 "PMMEASUREMENT" NUMBER,  realtion to other table(primary)
 "VERSION" VARCHAR2(40 CHAR),
 "DBOUTPUTDATE" DATE,
 "USERNAME356" VARCHAR2(60 CHAR),
 "PM_WORKBOOKREVISON" VARCHAR2(60 CHAR),
 "PM_METTLERTASK3 VARCHAR2(60 CHAR),'

---

---

---

--

64 colums i have....

)

 

CSV file

[PM]      
ItemID Section Value Unit
PM_TESTID   LL_20131009_002_R02  
PM_DBOutputDate   1/28/2014 16:46  
PM_Username   r000  
PM_WorkbookRevison      
PM_MettlerTask   T6  
c_PM_Weighted_Total   0.9090 mg/mi
c_PM_Chamber_RelHumAvg   5.6 %

----

-----

-----

---

 

64 rows i have....

 

Code :-- I hope iam doing wrong way please correct me...

 

Sub AddPM(ByRef Measurement, ByRef UnitCatalog)

'

' dim targetElems1 : set targetElems1 = Measurement.References("PMROOT").Elements

' dim channels : channels = GroupChannelsCheck_("PM", Array("ItemID", "Section", "Value", "Unit"))

' dim nrOfProperties : nrOfProperties1 = channels(0).Properties("length").Value

' msgbox nrOfProperties1

' dim instance1, instanceProperties1, section1

' dim valIndex : for valIndex = 1 to nrOfProperties1

'

' set instance1 = targetElems1.Add(channels(0).Values(valIndex))

'

' ' set instanceProperties1 = instance1.Properties

'' section = channels(1).Values(valIndex)

'' if "" <> section then

'' instanceProperties1("Version").value = section1 ' duplicate section to make names unique

'' instanceProperties1("Section").value = section1

'' end if

' ' instanceProperties1("Value").value = DoubleVal_(channels(2).Values(valIndex))

'' if NOT UnitCatalog is nothing then

'' dim unitStr : unitStr = channels(3).Values(valIndex)

'' if Not IsEmpty(unitStr) AND Not "unitless" = unitStr then

'' dim unitInstance : set unitInstance = UnitCatalog.GetUnit(unitStr)

'' if NOT unitInstance is nothing then

'' instance.References("unit").Elements.AddReference unitInstance

'' end if

'' end if

'' end if

'msgbox valIndex

0 Kudos
Message 11 of 16
(2,836 Views)

 

Hello  brad,

 

Good Morning

 

One of my friend assist me to do like this way...

 

The error message means the you have forgot to set the relation from the PMRoot instance to the Measurement instance.

 you have to do it once for PMRoot, but the instance of Measurement must be available in the ODS Storage. When you have written the PMRoot instance, you have to create the relation from PMCalc instance to PMRoot instance.

0 Kudos
Message 12 of 16
(2,821 Views)

HI musunurudiadem,

 

So, do I understand correctly that you want to load a CSV that contains unit strings and insert any new ones to an ASAM-ODS unit catalog?  If that is the case, why wouldn't you want to have 4 channels in DIAdem and loop over all the rows of those 4 channels, with one row corresponding to one new unit definition?  In that case you don't need a DataPlugin or channels at all, you could just read the ASCII file with the TextFile... commands in DIAdem or the FileSystemObject in VBScript.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 13 of 16
(2,816 Views)

Hi Brad, 

Here first I am trying to insert ITEMID and corresponding VALUE . remaing 2 iam not sending to database. 

but here i have realtions with PMROOT,PMCALC and MEASUREMENT table.  ID is the key 

How do I create realation b/w tables ?

0 Kudos
Message 14 of 16
(2,813 Views)

Hi musunurudiadem,

 

I have actually never edited an ASAM-ODS unit catalog, so I'm not the right person to help you with that.  Andreas Krantz said this morning that he sent you an email recently-- was he correct in guessing/remembering your Discussion Forum name?  He's much more knowledgable about this than I am.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 15 of 16
(2,796 Views)

Hello Brad,

 

Thank you so much for your help.

 

 

 

Thanks & regards

-------------------

dilip

0 Kudos
Message 16 of 16
(2,794 Views)