Where are the values (Row1Value1 for example) coming from now?
I'm parsing with cfhttp an external webpage and then I'm stripping the code at a point where I got the discussed html table left. I'm not sure whether this idea works to the end but I thought this would be at least a nice start.
Nice to read from you! I hope you can help me out (what you didi already severla times in the past - many thanks for this).
Once you get this data into a variable type that you like, how do you plan to use it?
I would then strip certain data types (p.e. everything in column 2) and output 'em into a text file....
The best would be to have the entire table data in a query...
If the programming that creates the external web page could be made available as a web service or something, that would be nice. If not, you could do something like this.
Replace all the <tr> tags with a delimeter
Replace all the <td> tags with another delimiter.
Replace the <html> tag and all the closing tags with empty strings.
You should now have nested lists which should be sufficient for the task at hand.
I'm now at a point where I got the following content in my string:
I used $$ to replace </tr> (the last cell of each row) and commas at the end of each cell value. You were talking about nested lists. Can you give me a hint or even better an example on how to put that stuff in a query? This would be fantastic...
First, don't use $$ as a delimiter. Delimiters can only be one character. Next, using commas is dangerous because there might be commas in the data.
With the nested lists, you should be able to create your text file. In fact, if you use chr(10) as your outer delimeter and chr(9) as the inner, you might even be able to use the result as a simple string and not have to loop through your lists. That of course is based on the assumption that you want a tab delimited file.
thank you very much for your inputs. So far I have changed my string to:
The text file I was talking about is actually the very end of my story. It would be even more helpful if I would be able to start creating a query from my string above. Most probably I have to go through the lists. But I'm stuck way before:
How do I create from the string above n lists containing 3 values (word;number;number with two digits)?
How can I count the sets of data from the string above (in my example above there are 4, but this is always different)?
I think as soon these two questions are answered I will be able to do what I need.
Thanks for more patience...
Meanwhile I even managed to remove all tabs, carriage returns and line feeds. My string looks now like this:
From here all you need to do to get the 3 values of word;number,number is to treat the string as a | delimited list.
Thank you. With your input I was able to solve my problem at the end like this:
<cfset myQuery = QueryNew("fruit,quantity,quality")>
<cfloop index="ListElement" list="#myRow#" delimiters="|">
<cfset temp = QueryAddRow(myQuery)>
<cfset Temp = QuerySetCell(myQuery, "fruit", "#Trim(ListGetAt(ListElement, 1, ';', 'yes'))#")>
<cfset Temp = QuerySetCell(myQuery, "quantity", "#Trim(ListGetAt(ListElement, 2, ';', 'yes'))#")>
<cfset Temp = QuerySetCell(myQuery, "quality", "#Trim(ListGetAt(ListElement, 3, ';', 'yes'))#")>