Page 1 of 1

User VAriable Activity

Posted: Mon Sep 08, 2008 12:35 pm
by PRIYARAJ
Hi All,

I have defined multiple User Variables in my sequence.I am getting some parameters from Hash Table using UtilityHashLookup. I have a User variable "A" which is extracted from Hash table and its value is abc/def/ghi.
I have another User variable "B" and its avlue is abc/def/ghi/jkl/mno/.
Since part of "B" has A's value,I need to concatenate A with B.Can anyone please give me the Correct format of Concatenating the User Variable "A" with hardcoded value of "B".
So that the output of "B" would be abc/def/ghi/jkl/mno

Thanks in Advance!

Posted: Mon Sep 08, 2008 1:42 pm
by chulett
How much help do you need? You use a colon to concatenate so simply mention the two field names separated by a ":".

Posted: Mon Sep 08, 2008 1:47 pm
by PRIYARAJ
Hi,

It looks very simple.But it doesn't work and I tried lot of other combinations.I In User Variable activity,under Name tab for Variable "B" the expression which I gave was 'A':'/jkl/mno/pqr'.The outbound that I get is A/jkl/mno/pqr.
But the Value of variable A is not Concatenated.
I even tried A:'/jkl/mno/pqr' but it says Variable 'A' not defined.
It is not that I don't know to use concatenation but I wanted to use a varibale within an expression for another variable.

Thanks!

Posted: Mon Sep 08, 2008 1:54 pm
by chulett
You can't quote a field name, it will end up as a literal as you found. And you need to qualify the field name with the stage name, StageName.A would be more appropriate if you've got the field name correct.

Posted: Mon Sep 08, 2008 2:13 pm
by PRIYARAJ
I did try the expreesion UserVariables.A:'/jkl/mno/pqr' for varaible "B" but it says Variable 'UserVariables.A' not defined.

Posted: Mon Sep 08, 2008 2:20 pm
by chulett
Then you need to find out what the stage/field name really is. The 'Insert Parameter' helper widget should allow you to pick it from the GUI rather than you hand typing it.

Posted: Mon Sep 08, 2008 2:39 pm
by PRIYARAJ
Yes,I even tried to select from "Insert Parameter' but it didn't show me the list of User Variables in there to select.So I dont think so I can use one UserVariable within the Expression of other Variables.

Posted: Mon Sep 08, 2008 3:14 pm
by chulett
You can, but now I'm confused. Where exactly are you trying to concatenate these two UserVariables stage values together?

Posted: Mon Sep 08, 2008 3:25 pm
by PRIYARAJ
Inside the User Variable Activity,I want to Concatenate One User Variable with the expression value for another User Varaible.
Inside User Variable Activity I have two Variables :
1.ETLROOTDIR (The expreesion for this variable is extracted from hashtavle using UtilityHashLookup ) which is /mdm/dev/datastage/customer(output value).This will differ based on the ENV Parameter that we pass.For TEST Env it would be /mdm/test/datastage/customer.
2.ShFileDir (The expression for this is hard coded as /mdm/dev/datastage/customer/SCRIPTS/OUTBOUND.I thought instead of hardcoding the entire expression,I would use ETLROOTDIR variable for '/mdm/dev/datastage/customer/' and concatenate with '/SCRIPTS/OUTBOUND')
Right now,I had to manually Change ShFileDir expression whenever we migrate from one environment to another environment.So that is why I thought I would make use of ETLROOTDIR in ShFileDir which is extracted appropriately based on each environment .
So IF I concatenate ETLROOTDIR with ShFileDir then I dont have to manually change the expression value for ShFileDir in each environment

Posted: Mon Sep 08, 2008 3:39 pm
by ray.wurlod
A User Variables activity derivation can not access other variables in the same User Variables activity. I don't like it either (or the need to add a row to the grid manually) but that's how things are. You need a second, downstream, User Variables activity that can use the variables from the first.

Posted: Mon Sep 08, 2008 3:40 pm
by PRIYARAJ
Thanks a lot for all your Quick Replies.

Posted: Mon Sep 08, 2008 3:43 pm
by chulett
Sorry, I was under the impression you had two UserVariable stages for some reason, which is why I said you could use one from another. You could also concatenate them together when you use them rather than in the stage itself.