Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making variables available to post-session procs...

Status
Not open for further replies.

JScannell

Programmer
Jan 9, 2001
306
US
I have a good question. Does anyone know how I can transfer a piece of data from a mapping and make it available in the post-session procedure of a workflow?

I have looked for global variables and there doesn't appear to be such a thing. I have looked into system variables but they are limited.

What I need to do is create x number of dummy records at the end of my workflow. The value of x is known in the mapping, but I need it in the post-session procedure.

Thank you in advance,


Jerry Scannell
 
Global variables are not yet available, but as you know variable values are persistent values stored in the repository. So prior to version 8 you can select the table opb_map_persisval and select the pv_value for a given mapping_id,session_inst_id and pv_id (the last one only if you have more than 1 variable in the mapping)

So, store the value you need as a mapping variable and read its value from the repo when you need it..

Ties Blom

 
Thnanks for the quick response. Since I have never used the persistent values you reference, do you have an example of populating and then using such a var?

For instance, let's say that I have a value, say Record_Count, that I need to pass to a DOS batch file in my post session process. I can currently pass one of the server variables such as $PMSourceFileDir. Now I need to pass the Record_Count as well.

Please provide sample code that would make that happen. I can only presume initially that the variable is populated inside the mapping and then somehow retrieved in the post-session process.

Thanks again,

Jerry Scannell
 
mapping variable is stored as persistant value.
In your case just add a sequence generator to the mapping and write the max value to a flatfile.

In that case you do not even need a variable or parameter.

Ties Blom

 
Actually I need the variable. My example to you wasn't what I really was doing. The bottom line is I calcualte a number and place it in a persistent variable. At the post-session of the workflow I need to transfer that value to a DOS batch file.

So I still need to know what to do. I found where you can tag a variable as persistent but I don't know where or how to retrieve it at the end of my workflow.

Thanks,

Jerry Scannell
 
As I already wrote:

The value of persitant values are stored in the repository
To be exact in opb_map_persisval.

With the proper SQL selection you could fetch it from there, but I understand this may be too much to ask.

However there is nothing to stop you from adding an additional target to the mapping and write the value from the variable to that target (a flatfile in this case)

However, you want to write 1 line to the flatfile, so add a 'dummy' aggregator prior to writing to the flatfile to make sure you write one line (regardless to the number of records processed in the mainflow)

You can do this all within one mapping..

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top