You are viewing limited content. For full access, please sign in.

Question

Question

Limit Read XML with token

asked on January 22, 2018

Hello,

I am looking to retrieve some information via the 'Read XML' activity. 

The piece of the XML that I am working with is below:

<LocalProcessing>
<ArrivalCartageRef/>
<DeliveryCartageAdvised/>
<DeliveryCartageCompleted>2018-01-19T10:52:00</DeliveryCartageCompleted>
<DeliveryLabourCharge>0.0000</DeliveryLabourCharge>
<DeliveryLabourTime/>
<DeliveryRequiredBy/>
<DemurrageOnDeliveryCharge>0.0000</DemurrageOnDeliveryCharge>
<DemurrageOnDeliveryTime/>
<DemurrageOnPickupCharge>0.0000</DemurrageOnPickupCharge>
<DemurrageOnPickupTime/>
<EstimatedDelivery/>
<EstimatedPickup>2018-01-15T15:52:00</EstimatedPickup>
</LocalProcessing> 

I am specifically interested in the 'Estimated Pickup' date, in bold above.

I can retrieve that information without issue using "//LocalProcessing/EstimatedPickup", however it pulls the whole of 2018-01-15T15:52:00 when I am only interested in 2018-01-15. 

I can use an 'Assign Token Values' activity to clean it up, but was wondering if there was a better/cleaner way, or a way I could do that in the Read XML activity?   

Thank you,

Darren

0 0

Answer

SELECTED ANSWER
replied on January 22, 2018 • Show version history

Hi Darren,

No if you just copy and paste the whole line in bold (as it is in the post above) it should work. The substring-before() part is a function which will just return the text before the "T".

Cheers, Dan

EDIT: It's described in more detail here if you want to take a look: http://www.peachpit.com/articles/article.aspx?p=1315438&seqNum=7

1 0

Replies

replied on January 22, 2018

Hi Darren,

You should be able to use this expression:

substring-before(//LocalProcessing/EstimatedPickup, 'T')

I hope this helps!

Cheers, Dan

2 0
replied on January 22, 2018

Hi Dan,

Are you saying the Xpath Expression should be: "//LocalProcessing/EstimatedPickup(//LocalProcessing/EstimatedPickup,'T')"?

0 0
SELECTED ANSWER
replied on January 22, 2018 • Show version history

Hi Darren,

No if you just copy and paste the whole line in bold (as it is in the post above) it should work. The substring-before() part is a function which will just return the text before the "T".

Cheers, Dan

EDIT: It's described in more detail here if you want to take a look: http://www.peachpit.com/articles/article.aspx?p=1315438&seqNum=7

1 0
replied on January 22, 2018

Thanks Dan!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.