JKI Discussion Forums
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Programitc Element names

#1
User is offline   ASTDan 

  • Group: Members
  • Posts: 9
  • Joined: 25-February 10
Hello,

Is there a way to create programmatic element names i.e. element names defined at run time not edit time.

For example I have data that I want to associate to it's location i.e. station 1, station 2, etc. I only know how many stations I have at run time.

I would like the stations to appear as columns in an xml table in excel. The way I think to do this is to define element names at run time.

I think I need something like the following.

<Current_Data>
<Station_1>1</Station_1>
<Station_2>2</Station_2>
<Station_3>3</Station_3>
<Station_4>4</Station_4>
<Station_5>5</Station_5>

The number of stations are unknown and they may not be sequential.

Any help would be appreciated.

Thanks

Dan
0 kudos

#2
User is offline   Jim Kring 

  • Group: JKI Team
  • Posts: 1,204
  • Joined: 15-March 06

View PostASTDan, on 27 July 2011 - 06:06 PM, said:

Hello,

Is there a way to create programmatic element names i.e. element names defined at run time not edit time.

For example I have data that I want to associate to it's location i.e. station 1, station 2, etc. I only know how many stations I have at run time.

I would like the stations to appear as columns in an xml table in excel. The way I think to do this is to define element names at run time.

I think I need something like the following.

<Current_Data>
<Station_1>1</Station_1>
<Station_2>2</Station_2>
<Station_3>3</Station_3>
<Station_4>4</Station_4>
<Station_5>5</Station_5>

The number of stations are unknown and they may not be sequential.

Any help would be appreciated.

Thanks

Dan


Hey Dan,

What are the requirements (in terms of XML data structure) of an Excel XML Table?

Also, there are a few ways to represent ordered arrays of data. Here's one way to do it (using an attribute to store the station number):

<Current_Data Station="1">1</Current_Data>
<Current_Data Station="2">2</Current_Data>
<Current_Data Station="3">3</Current_Data>

If you really want to use the exact XML schema you showed, then you'll need to use a Variant representation of your cluster and construct its elements and their names dynamically (e.g. using the OpenG LabVIEW Data Tools library for variant manipulation).

-Jim
0 kudos

#3
User is offline   ASTDan 

  • Group: Members
  • Posts: 9
  • Joined: 25-February 10

View PostJim Kring, on 27 July 2011 - 06:25 PM, said:

Hey Dan,

What are the requirements (in terms of XML data structure) of an Excel XML Table?

Also, there are a few ways to represent ordered arrays of data. Here's one way to do it (using an attribute to store the station number):

<Current_Data Station="1">1</Current_Data>
<Current_Data Station="2">2</Current_Data>
<Current_Data Station="3">3</Current_Data>

If you really want to use the exact XML schema you showed, then you'll need to use a Variant representation of your cluster and construct its elements and their names dynamically (e.g. using the OpenG LabVIEW Data Tools library for variant manipulation).

-Jim


Thanks for the Reply Jim,

The requirements are I want my customer to use XML because I think they need it. They want a file that looks warm and fuzzy in excel, because excel is all they know. Down the road when they have 80 gazillion xml files, porting the xml data to data base will be a snap (which I think would be cool). I am trying to figure out a data structure using the Easy XML toolkit that would satisfy both wayward engineers.

I tried the attribute. Cool, but didn't quite work.

How do I make Variant representation of cluster and construct its elements and their names dynamically? I have the OpenG LabVIEW Data tools Library. What functions would allow me to do this?

Thanks

Dan
0 kudos

#4
User is offline   ASTDan 

  • Group: Members
  • Posts: 9
  • Joined: 25-February 10
Hello Jim,

I figured it out!

Yes dynamically adding elements to a variant worked!

Attached Image: Variant.PNG

Thanks for you help Jim!
0 kudos

#5
User is offline   Jim Kring 

  • Group: JKI Team
  • Posts: 1,204
  • Joined: 15-March 06
Winner, winner, chicken dinner! :)
0 kudos

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic