Skip to Content
0

Write Variable is not working

Apr 17 at 04:23 AM

52

avatar image

Hi Integration Experts,

I have a delta sync scenario which I need to use a write variable to keep the last run date time in this format yyyyMMddHHmmss and retrieve it in the next run. In the content modifier I have defined a field ShipDate and it was filled during runtime. I also defined a write variable based on the field I created earlier but the value was not written. Any idea what is wrong?

Best Regards,

Jeremy

dmtfp.png (22.5 kB)
fc8vf.png (19.7 kB)
qqz0o.png (11.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Ashish Goel Apr 17 at 06:59 AM
0

Hi Jeremy,

Try displaying/checking the value of ShipDate if it is setting at runtime to the property properly. You can try it giving constant value in property.

Also, In write variable , check the box Global scope if it helps. Here also, you can try with current date and time.

capture1.jpg

Thanks,

Ashish


capture1.jpg (17.0 kB)
Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Ashish

Try displaying/checking the value of ShipDate if it is setting at runtime to the property properly.

>I logged the value of ShipDate and it was passed correctly at runtime.

Also, In write variable , check the box Global scope if it helps. Here also, you can try with current date and time.

>If I use the current date and time then it works. However my requirement is to use the computed date and time based on the response but then the write variable does not work anymore.

Regards,

Jeremy


0

In that case, try with Xpath expression in write variable.

I used xslt to remove namespace from XML so xpath can be parsed. No need to set in property. For me it worked.

1

Thanks Ashish,

It works by using xpath. In principle it should work with property and header fields as well because it worked if I used the current date time but it is not the case. Anyway my problem is solved.

Have a nice day!

Best Regards,

Jeremy

0
Jeremy L Apr 17 at 04:26 AM
0

Hi Sriprasad Shivaram Bhat,

You are always welcomed. :)

Thanks,

Jeremy

Share
10 |10000 characters needed characters left characters exceeded
Praveen Tirumareddy
Apr 17 at 04:35 AM
0

Hi Jeremy,

Please find attached following changes.

this should help!

thanks and regards,

Praveen T


chnage.jpg (76.3 kB)
Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hello Praveen,

I tried what you suggested but the problem is not solved. I am using a script to update the property.ShipDate and the value can be kept but when using write variable with the same field it is not working unfortunately.

Regards,

Hui Bin

0

Hi Jeremy,

Is it possible to share the i-flow with us.

would need to check in which order are you writing in the script.

Alternatively you could write the property value in the datastore/log and check if the value is set before writing on to the write-variable.

thanks and regards,

Praveen T

0
Praveen Tirumareddy

Hi Praveen,

Sure. The iflow looks like this. Content Modifier 9 is the response

In the content modifier 7 I defined the property field "Shipdate"

In the script I update the property field "ShipDate" based on the ship date in the response like this format 201801010000.

Lastly, I write the variable as mentioned earlier above but nothing is written.

Regards,

Jeremy

1.png (10.1 kB)
2.png (38.6 kB)
0

Hello Jeremy,

Please use below code in the script to check if there any value present in the property.

def map = message.getProperties();
def ShipDate= map.get("ShipDate")
def messageLog = messageLogFactory.getMessageLog(message)
if (messageLog != null) {
  messageLog.setStringProperty("ShipDate", ShipDate);
}

thanks and regards,

Praveen T

0
Praveen Tirumareddy

Thanks Praveen,

The problem is already solved by using xpath.

Regards,

Jeremy

0