Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Parsing an xml that is stored in a sql column Post Reply Post New Topic
Author Message
scott.morrison
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 12
Quote scott.morrison Replybullet Topic: Parsing an xml that is stored in a sql column
    Posted: 13 Jan 2015 at 2:00pm
Due to the nature of the content stored within my db, I cant reveal a few things, but I need to parse a xml. I looks like below (you can see where i censored). I am looking for the value within "current=___" which is within the first (highest) level of the xml code. and I need to pull it from each record in the database in relation to its unique ID. column 1 is unique id and column two is the xml column. anyone have any suggestions?? I'd appreciate any help.



<manifest xmlns:ver="a url i can't reveal" current=" the data i am looking for" ID=" a number i cant reveal and is useless" documenttype="a type i cant reveal" censoredCount="1">
     <phase id= blah blah>
          somemore sub sets of data
     </phase>
     <phase id= blah blah>
          more sub sets of data
     </phase>
</manifest>
V/R
Scott
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 16 Jan 2015 at 5:06am
are you passing the data as xml to the report, or are you getting xml from a field in the database?

if the former, just set the datasource to ado and cr will parse.

if the later, I would probably split using <, then look at the first array element for the word 'current' and grab everything after the =. Then I would probably split again on ", and just take the 1st data element..or 2nd, depends on how CR numbers the array elements.

HTH
IP IP Logged
scott.morrison
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 12
Quote scott.morrison Replybullet Posted: 16 Jan 2015 at 5:08am
I am getting the xml from a a field in the DB. I am not as familiar with parsing in crystal. Is there a way parse directly from that field?
V/R
Scott
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 16 Jan 2015 at 5:10am
I don't think so. CR may have that ability, but I doubt. If you are storing text in a field, CR will see it as a string, so you would need to parse it that way.

at least that is my belief
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.