cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
420
Views
0
Helpful
3
Replies

XML transform and upload without overwriting additional variables

asilvera4
Level 1
Level 1

I have a set of working scripts where a user calls into one application to enter their contact number. People needing to reach that first user call the second application which reads the string value entered by the first user and dials out to them. This works via a simple xml transform and upload for the first script, and an xml get in the second.

I've been requested to do this for 40 additional people.

I made one template with a different %variable% for each user. Via a PIN, the correct variable is transformed and a singular doc is uploaded. The problem is that this uploaded doc erases the last person's transformation and reverts it back to %variable%.

Essentially I'm trying to avoid creating 40 different transformed xml uploads. Anybody have a clever idea? If it involves XSL please give a specific exmample; I'm not versed in that.

 

3 Replies 3

Samuel Womack
Level 5
Level 5

I don't even think that's your biggest problem..What if 2 Callers are on simultaneously? Whichever document gets there (uploaded) Last is the most up to date right?

Hi

Firstly, Sam raises a very good point. This sort of thing would be much better dealt with by using a proper DB so you can independenly edit records for each user.

However if we assume this is a low-throughput system with infrequent changes and you are happy to take the chance of two concurrent changes occurring and one being lost...

What I do with XML mostly is read it, parse it with the built-in steps. When it  comes to writing them, you can just read the whole doc, convert it to a string, and then use DO steps with Java code to edit the XML directly once read from the repo.

Basicallly as you need to maintain the existing data, you need to either:

1) read each bit of data into an array and then write that back into your template along with the new data

2) read each bit of data into an array and then write them all back by building up the XML manually with java

3) read the whole current XML from the repo, then do a quick find/replace in it using a regex and write it back

Aaron

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

Thanks guys.

Yes, this is a very, very low volume application, and with each record being assigned to one user there should never be a case were concurrent changes are made to a singular variable. It's just a menu of various on-call engineers, and this is how the engineers change the number of the person on call via DTMF. A DB would be ideal, but I'd have to get project and cost codes to request one - not worth it.

I will play around with Option 1 for a bit, but it's probably just easier to have the 40 3-line xml files.