<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GDL XML Extension - Reading External File in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-XML-Extension-Reading-External-File/m-p/120553#M27789</link>
    <description>Yes, the documentation on the XML extension is prosaic and I have not been able to fathom it so far so would be great if anyone can help. Stuff like:&lt;BR /&gt;
"&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;When we want to walk through the nodes of the tree, first we have to request a new position descriptor from &lt;BR /&gt;
the extension. Originally a new descriptor points to the root element. The descriptor is in fact a 32 bit identification number whose value has no &lt;BR /&gt;
interest for the GDL script. The position it refers to can be changed as we move from one node in the tree to another.&lt;E&gt;&lt;/E&gt;" (GDL reference manual)&lt;BR /&gt;
Huh?? &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_confused.gif" style="display : inline;" /&gt; &lt;BR /&gt;
I find tab delimited text files work fine for most things. On a mac if you have 'Numbers' it will open directly into a spreadsheet ( but not save as text ). In XL these can also be imported.&lt;BR /&gt;
&lt;BR /&gt;
To answer your question, you can search a column to find an identifier and select another row in that column in tab delimited text files. I have done this for titleblocks myself but don't have the script to hand&lt;BR /&gt;
&lt;BR /&gt;
Here is another example :&lt;BR /&gt;
DIM stpan [20] [4] !!! array for data&lt;BR /&gt;
chst= OPEN ("TEXT", "solar_energy.txt"  ,   " MODE = RO, LIBRARY" ) &lt;BR /&gt;
	lincont=1&lt;BR /&gt;
	solinp=INPUT (chst, lincont ,1, val1, val2, val3, val4)&lt;BR /&gt;
	WHILE stlpan&amp;gt;0 DO&lt;BR /&gt;
	stpan[lincont] [1]=val1&lt;BR /&gt;
	stpan [lincont][2]=val2&lt;BR /&gt;
	stpan [lincont] [3]=val3&lt;BR /&gt;
	stpan[lincont] [4]=val4&lt;BR /&gt;
	lincont=lincont+1&lt;BR /&gt;
	solinp=INPUT (chst, lincont ,1, val1, val2, val3, val4)&lt;BR /&gt;
	ENDWHILE&lt;BR /&gt;
	CLOSE chst&lt;BR /&gt;
!!!______________find the row of the identifier parameter&lt;BR /&gt;
	FOR linconti=1 TO lincont&lt;BR /&gt;
	IF stpan [linconti] [1]= identparam THEN !!!where identparam is your identifier&lt;BR /&gt;
	outcomeval=  stpan[linconti] [3] !!! where the value to be read is in column 3 and outcomeval is the value.&lt;BR /&gt;
	ENDIF&lt;BR /&gt;
	NEXT linconti&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps. It is a bit clumsy because there is a problem inserting texti/o into for next loops directly- they don't work!( or last time I tried in AC9)&lt;BR /&gt;
 &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_cry.gif" style="display : inline;" /&gt;</description>
    <pubDate>Sat, 28 Jun 2008 15:01:11 GMT</pubDate>
    <dc:creator>Richard Swann</dc:creator>
    <dc:date>2008-06-28T15:01:11Z</dc:date>
    <item>
      <title>GDL XML Extension - Reading External File</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-XML-Extension-Reading-External-File/m-p/120552#M27788</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;Hello all,&lt;BR /&gt;
&lt;BR /&gt;
The AC11 documentation is very difficult to understand when it comes to the XML extension and I have had no luck finding further information on the internet so I hope you can help.&lt;BR /&gt;
&lt;BR /&gt;
I am trying to script a drawing title block object that opens an external XML file (a spreadsheet created with excel), searches for the current drawing number and returns several fields from that row (drawing title, revision number, etc)&lt;BR /&gt;
&lt;BR /&gt;
Using the Data/Text I/O function it is fairly simple to return a field from a known row and column of a specific txt file. I would like to have the ability to search for a term in one column and return a value from the same row of another column.&lt;BR /&gt;
&lt;BR /&gt;
I think my trouble is with the INPUT command. I need help setting the recordID and fieldID correctly:&lt;BR /&gt;
&lt;BR /&gt;
ch1 = OPEN ("XML", "C:\Book1.xml", "f" )&lt;BR /&gt;
INPUT (ch1, recordID, fieldID, var1, var2...)&lt;BR /&gt;
close (ch1)&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 27 Jun 2008 18:14:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-XML-Extension-Reading-External-File/m-p/120552#M27788</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-06-27T18:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: GDL XML Extension - Reading External File</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-XML-Extension-Reading-External-File/m-p/120553#M27789</link>
      <description>Yes, the documentation on the XML extension is prosaic and I have not been able to fathom it so far so would be great if anyone can help. Stuff like:&lt;BR /&gt;
"&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;When we want to walk through the nodes of the tree, first we have to request a new position descriptor from &lt;BR /&gt;
the extension. Originally a new descriptor points to the root element. The descriptor is in fact a 32 bit identification number whose value has no &lt;BR /&gt;
interest for the GDL script. The position it refers to can be changed as we move from one node in the tree to another.&lt;E&gt;&lt;/E&gt;" (GDL reference manual)&lt;BR /&gt;
Huh?? &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_confused.gif" style="display : inline;" /&gt; &lt;BR /&gt;
I find tab delimited text files work fine for most things. On a mac if you have 'Numbers' it will open directly into a spreadsheet ( but not save as text ). In XL these can also be imported.&lt;BR /&gt;
&lt;BR /&gt;
To answer your question, you can search a column to find an identifier and select another row in that column in tab delimited text files. I have done this for titleblocks myself but don't have the script to hand&lt;BR /&gt;
&lt;BR /&gt;
Here is another example :&lt;BR /&gt;
DIM stpan [20] [4] !!! array for data&lt;BR /&gt;
chst= OPEN ("TEXT", "solar_energy.txt"  ,   " MODE = RO, LIBRARY" ) &lt;BR /&gt;
	lincont=1&lt;BR /&gt;
	solinp=INPUT (chst, lincont ,1, val1, val2, val3, val4)&lt;BR /&gt;
	WHILE stlpan&amp;gt;0 DO&lt;BR /&gt;
	stpan[lincont] [1]=val1&lt;BR /&gt;
	stpan [lincont][2]=val2&lt;BR /&gt;
	stpan [lincont] [3]=val3&lt;BR /&gt;
	stpan[lincont] [4]=val4&lt;BR /&gt;
	lincont=lincont+1&lt;BR /&gt;
	solinp=INPUT (chst, lincont ,1, val1, val2, val3, val4)&lt;BR /&gt;
	ENDWHILE&lt;BR /&gt;
	CLOSE chst&lt;BR /&gt;
!!!______________find the row of the identifier parameter&lt;BR /&gt;
	FOR linconti=1 TO lincont&lt;BR /&gt;
	IF stpan [linconti] [1]= identparam THEN !!!where identparam is your identifier&lt;BR /&gt;
	outcomeval=  stpan[linconti] [3] !!! where the value to be read is in column 3 and outcomeval is the value.&lt;BR /&gt;
	ENDIF&lt;BR /&gt;
	NEXT linconti&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps. It is a bit clumsy because there is a problem inserting texti/o into for next loops directly- they don't work!( or last time I tried in AC9)&lt;BR /&gt;
 &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_cry.gif" style="display : inline;" /&gt;</description>
      <pubDate>Sat, 28 Jun 2008 15:01:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-XML-Extension-Reading-External-File/m-p/120553#M27789</guid>
      <dc:creator>Richard Swann</dc:creator>
      <dc:date>2008-06-28T15:01:11Z</dc:date>
    </item>
  </channel>
</rss>

