Skip to Content
0

HCI: Using variables from data store / global variables

Aug 23, 2017 at 09:56 AM

1.3k

avatar image
Former Member

Hi experts,

I am trying to persist the last successful run date of an interface in a data store to be used for the next run.

However, how can I do this?

Do I 'write variable' or do I 'Data Store -> Write'?

Also, how can I get this value and output it in content modifier or use it in channels?

edit: also, how can I persist a value that I computed in a groovy script?

Thanks.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Sriprasad Shivaram Bhat
Aug 23, 2017 at 03:15 PM
0

Hello Raye,

You can use write variable ( either Local or Global it depends on your requirement ).

You can retrieve the same in your content modifier.

When you run your interface for the first time value would be blank ( you can design in such a way what needs to be added if its first run or else you can provide default value)

Regards,

Sriprasad Shivaram Bhat


Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Sriprasad,

Thank you for your answer. How can I use the variable from Script for Channel? Example, I need to retrieve records from SF 1 month before current date. Since, we are not able to add dynamic dates in the query, can we store the value (currentdate - 1 month) in a variable and place it in a channel filter for request/reply?

0
Sriprasad Shivaram Bhat
Aug 27, 2017 at 04:07 PM
0

You can't directly manipulate the date in channel, instead you can do the manipulation in script and save that date into a property or header and later use it in communication channel.

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 03, 2017 at 09:24 PM
0

Hi Sriprasad,

How will I know if the value has been persisted? I tried your proposed solution, with 1900-01-01T00:00:00.000Z as default value on the initial run. However, on the succeeding runs, it seems like the test process is still using the default value on the query.

Thanks!

Jon

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Jon,

You will not be able to view the data stored in Global Or Local Variable directly.alternatively you can do 2 things

1) Set the global variable value to Header or property and you can view it by adding Send Step with Sender channel ( mail or file ) and content modifier with header which you have set earlier as body,this is purely for testing purpose.

2) If you are using Script to form compound employee query with filter just add below code snippet ( You need to add this to your Script) which will print the query you have performed in MPL every time you run the interface.

    //Set the query or filter to Property "Prop_QueryFilter"
    property_WhereClause = pMap.get("Prop_QueryFilter");
    def messageLog = messageLogFactory.getMessageLog(message)
	if (messageLog != null) {
		messageLog.setStringProperty("WhereClause", property_WhereClause);
	}

Regards,

Sriprasad Shivaram Bhat

0