How to merge two records of xml Options
Nehaa
Posted: Thursday, July 10, 2008 4:58:11 PM
Rank: Newbie

Joined: 7/10/2008
Posts: 2
My xml contains the reords of an employee shift and it's task. so it might be possible that one employee in one has to do many task. so my xml contains the reords as:
<Detail>
<idShiftNo>72</idShiftNo>
<idEmployee>221265</idEmployee>
<NameEmployee>Biswal, Antje</NameEmployee>
<Date>2007-01-05T00:00:00+05:30</Date>
<Department>1</Department>
<ShiftName>F11</ShiftName>
<ShiftStart>2007-01-05T02:30:00+05:30</ShiftStart>
<ShiftEnd>2007-01-05T11:00:00+05:30</ShiftEnd>
<idTaskNo>324</idTaskNo>
<strNameJob>C-DE</strNameJob>
<idTaskNo1>324</idTaskNo1>
<TaskStart>2007-01-05T02:30:00+05:30</TaskStart>
<TaskEnd>2007-01-05T04:15:00+05:30</TaskEnd>
<TaskName>C-DE5824</TaskName>
<fontColorHTML>#000000</fontColorHTML>
<backColorHTML>#C0C0C0</backColorHTML>
<ToolTip>Flight: Job: C-DE Task:C-DE5824 STA: STD: 03:45 AcOP: DE AcType: 320 Dest: TFS

PaxMax: 174 PaxBkd: 176</ToolTip>
</Detail>
<Detail>
<idShiftNo>72</idShiftNo>
<idEmployee>221265</idEmployee>
<NameEmployee>Biswal, Antje</NameEmployee>
<Date>2007-01-05T00:00:00+05:30</Date>
<Department>1</Department>
<ShiftName>F11</ShiftName>
<ShiftStart>2007-01-05T02:30:00+05:30</ShiftStart>
<ShiftEnd>2007-01-05T11:00:00+05:30</ShiftEnd>
<idTaskNo>292</idTaskNo>
<strNameJob>BO</strNameJob>
<idTaskNo1>292</idTaskNo1>
<TaskStart>2007-01-05T04:15:00+05:30</TaskStart>
<TaskEnd>2007-01-05T04:55:00+05:30</TaskEnd>
<TaskName>DE5824</TaskName>
<fontColorHTML>#000000</fontColorHTML>
<backColorHTML>#C0C0C0</backColorHTML>
<ToolTip>Flight: Job: BO Task:DE5824 STA: STD: 03:45 AcOP: DE AcType: 320 Dest: TFS PaxMax:

174 PaxBkd: 176</ToolTip>
</Detail>

The problem is that as i have to show this on a chart then there it shows as

72 Biswal, Antje shiftstarttime shiftendtime task1
72 Biswal, Antje shiftstarttime shiftendtime task2

but i wan't to show it like
72 Biswal, Antje shiftstarttime shiftendtime task1 task2


i have done to display the id,name,shiftstart and end as thay are same in all by just using distinct
72 Biswal, Antje shiftstarttime shiftendtime

but how can i merge the two task records .


please help me in this
m waiting for ur replies :(
darrenjferguson
Posted: Thursday, July 10, 2008 5:04:09 PM

Rank: Aficionado

Joined: 3/19/2008
Posts: 192
Location: London, UK
I think you'll need to provide a lot more detail in order to get a decent answer here.

What do you mean by a chart? Are you trying to do this in Umbraco? Are you using XSLT.

Your question isn't clear at all....

Darren Ferguson - Umbraco level 2 certified
www.darren-ferguson.com - www.fergusonmoriyama.com
Nehaa
Posted: Friday, July 11, 2008 7:37:48 AM
Rank: Newbie

Joined: 7/10/2008
Posts: 2
actually i have to show a chart showing the details of xml as it basically showing the employee task related to the time task start and end.Yes, m using xslt to provide it a stylesheet. m new in xslt and does not how to merge the nodes data dynamically.
psterling@homax
Posted: Friday, July 11, 2008 6:22:17 PM

Rank: Aficionado

Joined: 10/30/2007
Posts: 186
Location: Bellingham
Neeha -

If I'm correct in my assumption that the data you wish to chart is the task element then perhaps this pseudo code will help. I'm basing this on my implementation language of choice, C#, but I expect the approach will be similar with XSLT or Python, etc....


Code:
verify the common data (idEmployee, etc...) matches
-if we have a match
--for each xml record
---extract the value(s) of the needed element(s) (idTaskNo, etc...)
---collect the value(s) into a usable structure (hashtable, sorted list, etc...)
--set up you chart providing your collected values as the appropriate axis


I believe this is a rather straightforward problem solved easily by a variety of approaches.

Good luck and please post your solution back here,
-Paul




motusconnect.com :: level-2 certified :: MVP 2008/2009
See you at Codegarden08 US in Chicago!
drobar
Posted: Saturday, July 12, 2008 4:17:46 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
I will add that xslt cannot work with two xml files at the same time. Instead, you will need to merge multiple xml files into a single xml file and then have xslt parse it. That's just the nature of xslt.

I couldn't tell from your posts if you had two different types of data or two different data sources/files. If the latter, you'll need to combine them into a single xml stream before applying your xslt to it.

Alternatively, you could use c# and a user/custom control to do the processing. c# also has xpath abilities so that could be an option if you need more processing logic than xslt alone can provide.

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
Petr Snobelt
Posted: Monday, July 14, 2008 9:14:51 AM
Rank: Aficionado

Joined: 10/2/2007
Posts: 147
Location: Czech Republic
It looks you have xml structure something like this
<details>
<detail>
...
</detail>
<detail>
...
</detail>
</details>

Then you can use select distinct to select distinct id,name,shiftstart and end. Then on each distinct record you loop in all records with filter to id,name,shiftstart,end and write other values as task.

That's all, nothing too hard :-)

distinct in xslt
http://forum.umbraco.org/yaf_postst3127_Only-retrieve-unique-values-from-nodeset-with-XSLT.aspx
Users browsing this topic
Guest


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.