Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: new record from array value Post Reply Post New Topic
Author Message
eyal
Newbie
Newbie


Joined: 10 Jul 2012
Online Status: Offline
Posts: 2
Quote eyal Replybullet Topic: new record from array value
     Posted: 10 Jul 2012 at 6:42am
Hello,
My source is an xml file (ADO.NET(XML).
sample row from the source file:
<<<
<include criteria="region_text(&quot;grouping&quot;).replace(&quot; &quot;,&quot;&quot;) match &quot;WORKER:4025*&quot; ||&#xD;&#xA;region_text(&quot;grouping&quot;).replace(&quot; &quot;,&quot;&quot;) match &quot;WORKER:4026*&quot; ||&#xD;&#xA;region_text(&quot;grouping&quot;).replace(&quot; &quot;,&quot;&quot;) match &quot;WORKER:4303*&quot; ||&#xD;&#xA;region_text(&quot;grouping&quot;).replace(&quot; &quot;,&quot;&quot;) match &quot;WORKER:BB*&quot; ||&#xD;&#xA;region_text(&quot;grouping&quot;).replace(&quot; &quot;,&quot;&quot;) match &quot;WORKER:BC*&quot; ||&#xD;&#xA;region_text(&quot;grouping&quot;).replace(&quot; &quot;,&quot;&quot;) match &quot;WORKER:BE*&quot; " />
>>>
After stripping the values, separated by comma, I've split it so:
<<<
Stringvar Array a := Split(criteria,",");
Local Numbervar i;
Local stringVar outputString := "";
For i:=1 to Count(a) do
(outputString := outputString + a);
outputString;
>>>
result =
<<<
 WORKER:4025 
 WORKER:4026 
 WORKER:4303 
 WORKER:BB
 WORKER:BC
 WORKER:BE
>>>

I need to have a new row for each array value, to be joined with other fields.
How to create a new record for each value in the array?

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Jul 2012 at 3:32am
Sorry, CR doesn't 'create' rows of data, it just reports on the data that is there.
 
The simplest solution is to preprocess your xml to include the extra rows in either the same table or a table that you can link to OR you can add to the xml to include the additional data that you want for each item so that you can parse that into another array and display the 2 array values at the same time so that it 'looks' right...
 
either way the place to 'add' this data is in your middle tier or in data retrieval process.
 
Personally, I go with 'super' rows in my data retrieval so that everything I want to display on that row is in the row. If I need multiples rows of data, I would have multiple rows in my data, then display the 'common' stuff as group headers and the 'extra' stuff like this in details.  Shared variables/Running Totals keep the counts/averages correct, just a bit more work.
 
I haven't needed multiple arrays as I am suggesting as, well personnally, I don't think that arrays in CR are all that useful, they never seem to be able to do what I want/need them to, but I can see how they could work in this case
 
HTH


Edited by lockwelle - 11 Jul 2012 at 3:35am
IP IP Logged
eyal
Newbie
Newbie


Joined: 10 Jul 2012
Online Status: Offline
Posts: 2
Quote eyal Replybullet Posted: 12 Jul 2012 at 5:48am
Thanks lockwelle,
I'll import the xml into a sql DB, which will be the source of the report, instead of the ADO.NET(XML).
IP IP Logged
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