how to set different values forsamecoloumn in different rows
Moderators: chulett, rschirm, roy
how to set different values forsamecoloumn in different rows
hi all,
can any one please help me how to set the values of columns for different rows.
i.e.
i need to set a output column value for first row is(default to "x") and from second row onwards(>first row) the value of the same coloumn should be (default to "y")
how can i perform this.
thanks in advance,
can any one please help me how to set the values of columns for different rows.
i.e.
i need to set a output column value for first row is(default to "x") and from second row onwards(>first row) the value of the same coloumn should be (default to "y")
how can i perform this.
thanks in advance,
Thanx&Regards
scorpion
scorpion
Use a stage variable in a transform stage. You can either use a initial value that is changed after the first row or a condition which checks the @INROWNUM/@OUTROWNUM as kcshankar suggested to assign the column value depending upon which row is processed.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
hi kcs/ArndW
thanks for your replies,can you please help me out detail syntax.
Example:
for "empno" coloumn, i need to display the value for first row is "x"
and for remaining rows (>1st row),i need to display the value is "y"
can you please give me exact syntax to define in stage variable for above(emp)scenario...
thanks a lot in advance.......
thanks for your replies,can you please help me out detail syntax.
Example:
for "empno" coloumn, i need to display the value for first row is "x"
and for remaining rows (>1st row),i need to display the value is "y"
can you please give me exact syntax to define in stage variable for above(emp)scenario...
thanks a lot in advance.......
Thanx&Regards
scorpion
scorpion
Come now.
First off, a stage variable seems overkill for something as simple as this. All you need to do is check @OUTROWNUM to see if it is one or greater than one and set the value in the derivation of the column accordingly.
Are you saying you can't work out the "If Then Else" syntax?
First off, a stage variable seems overkill for something as simple as this. All you need to do is check @OUTROWNUM to see if it is one or greater than one and set the value in the derivation of the column accordingly.
Are you saying you can't work out the "If Then Else" syntax?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks! Chullet,
Tried "if then else" with @OUTROWNM in derivation of Transformer,it is working fine.
i need default value for a ouput coloumn like
"Employee= " : link.coloumnname: " , Dept=S_CODE"
Note: link.coloumnname is the value of one input coloumn
so i need display in an output coloumn value like:
"Employee= "inputcoloumnvalue",Dept=S_CODE"
i tried a lot but giving in some other way....
can you please helpme on this...
Tried "if then else" with @OUTROWNM in derivation of Transformer,it is working fine.
i need default value for a ouput coloumn like
"Employee= " : link.coloumnname: " , Dept=S_CODE"
Note: link.coloumnname is the value of one input coloumn
so i need display in an output coloumn value like:
"Employee= "inputcoloumnvalue",Dept=S_CODE"
i tried a lot but giving in some other way....
can you please helpme on this...
Thanx&Regards
scorpion
scorpion
When you are working inside the Derivation editor, there is an 'ellipsis' or three little dots like this (...) that you can click on for help building expressions. One of the operators it offers you is concatenation and in DataStage the concatenation operator is the colon or ':' sign.
You build up combinations of strings and link values by concatenating them together with the colon:
Which just so happens to match what you posted, so (theoretically) should mean it worked just fine for you and you don't actually have a problem after all.
So what "didn't work" when you tried that syntax? Please be as complete and clear as possible, with examples if at all possible.
You build up combinations of strings and link values by concatenating them together with the colon:
Code: Select all
"Employee= " : link.columnname : ",Dept=S_CODE"
So what "didn't work" when you tried that syntax? Please be as complete and clear as possible, with examples if at all possible.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
It looks as if you used a bad variable name, is it took the value as a literal instead of as a variable name. Please follow Craig's advice and use the drop-down boxes to insert the correct variable name.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hmmm... odd. What if you just put in, for test purposes,
"If @OUTROWNUM =1 Then 1 Else DSLink3.PermissionID" and see if that works?
"If @OUTROWNUM =1 Then 1 Else DSLink3.PermissionID" and see if that works?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You never actually said anything about it generating an error. I just got the impression that your output wasn't quite what you expected.
I'm still not clear on exactly what you are expecting as output. Are the double-quotes supposed to actually be in the field when all is said and done? If that's the case, you'll need to use a combination of single quotes around the outside of the strings so the double-quotes inside the strings just become data.
If that's not the error you are trying to solve, then I'm obviously still confused.
I'm still not clear on exactly what you are expecting as output. Are the double-quotes supposed to actually be in the field when all is said and done? If that's the case, you'll need to use a combination of single quotes around the outside of the strings so the double-quotes inside the strings just become data.
If that's not the error you are trying to solve, then I'm obviously still confused.
Last edited by chulett on Sun Feb 26, 2006 11:38 am, edited 1 time in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
hey Thanks alot Chullet,
it is working fine...i need to display "(double quotes)in the field value..
as you said i append single quotes before and after the values...
now i got the required out put value...
output is an .csv file but when i open in wordpad i found 3 double quotes synbols instead of one double quotes symbols..why?
it is working fine...i need to display "(double quotes)in the field value..
as you said i append single quotes before and after the values...
now i got the required out put value...
output is an .csv file but when i open in wordpad i found 3 double quotes synbols instead of one double quotes symbols..why?
Thanx&Regards
scorpion
scorpion
More than likely because you have quote delimited string fields in the file with quotes in the field. Then you have to 'quote the quote' in order for it to not confuse things. The important thing is - can the resulting file be read properly by whatever application it is destined for?scorpion wrote:output is an .csv file but when i open in wordpad i found 3 double quotes synbols instead of one double quotes symbols..why?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers