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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of resource registry variables in map rules

Status
Not open for further replies.

thisismondweep

Programmer
Apr 29, 2007
28
0
0
Prev ref: thread842-1267158


Hi,

We have a situation where different office ids are added quite often, and against one office id, there is a date that the map needs to output. Historically, every time an office id is added, the map needs to be modified to take it into considerations.

In order to avoid these frequent map modifications, I attempted to dynamically define the resouce variable to indicate the office and the corresponding date within the map itself. I tried doing this by combining the officeid and another string. Eg: ES1HUBDT would be constructed from office id ES1 and the string HUBDT. I would define a variable in the resource registry as ES1HUBDT with a value say 20070314. Then I link the resource registry to the map using a configuration file. However, when I attempt to refer to %Office ID +HUBDT%, it does not resolve to %ES1HUBDT%.

I am not sure why this would not work as this looks quite logical to me.The item Office ID already has ES1 in it and it just needs to append HUBDT to it to construct %ES1HUBDT% resource variable.



Thereafter, I tried to access %ES1HUBDT% directly within a map rule. I found out that event his did not get resolved to 20070314.

I am using DataStage TX 8.0

Any help would be highly appreciated.

TA,
Cheers,
Mondweep.
 
The Resource Registry only works for some functions and output cards, e.g. it'll work in the PUT and GET functions but not in a normal map rule.

It would be great if there was a function that could be called to resolve resource reg variables, but there isn't.

So, I would store your values in a file or database and read them in as a new input card and use the LOOKUP or SEARCHUP functions.

Olly.
 
Best thing to do is put the data in a file and read this in to pass values to the rule. That way only the file needs to be changed for new data.
 
Janhes/OllyC,

I understand your point. I will try it out in the morning. If it works, it would indeed be great for us. I will keep you updated with the results.

Thanks for your input!

Cheers,
Mondweep.
 
I resolved this problem in the following way:-

=IF( MEMBER(OfficeID HeaderRecord:ln5, {"ES1","IT1"}),

TEXTTODATE(VALID(DBLOOKUP("SELECT HUBDATE FROM EAI_APPL_HUB_DATES WHERE OFFICEID= '"+OfficeID HeaderRecord:ln5+"'","-DBTYPE %STRING_MAP_DB_TYP% -CONNECT %STRING_MAP_DBNAME% -USER %STRING_MAP_USERID% -PASSWORD %STRING_MAP_PASSWORD%"),
GETANDSET (ERROR_CODE:In1, FILLRIGHT("8"," ",10)) +
GETANDSET (REASON_CODE:In1, FILLRIGHT("S8888"," ",10)) +
GETANDSET (ERROR_MSG:In1, FILLRIGHT(TRIMRIGHT(ERROR_MSG:In1) + "Call to the EAI_APPL_HUB_DATES db in GO5 _GPPToHUB/F_mapDetails/TransactionValueDate fails;"+ LASTERRORCODE() +":"+LASTERRORMSG(), " ", 256))
)),

TEXTTODATE(PymtValueDate BodyRecord:In2))

What this allows is that I do not need to change the map everytime the date changes.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top