Friday, March 9, 2012

how to concatenate variables for RAW output filename i.e.@path + @filename?

Doesn't appear you can do this.

Am I wrong?

Please tell me I am.you can of course use a third variable (FullFileName), set the property evaluateasexpression to true and set the expression to [User:Stick out tongueath] + [User::filename], then use that

[User::FullFileName] as the variable for the output file name...

|||If you right click on the Raw File Destination and select properties, in the Custom Properties section, change the AccessMode to "File name from variable."

Then, build a third variable that uses expressions to concatenate @.path & @.filename. Then use that variable in the Raw File Destination's FileNameVariable property.|||I can't get this working

@.var1 = c:\temp
@.var2 = output.raw
@.var3 = @.var1 + @.var2 [evaluate as expression set to true]

it won't let me select the raw output filenameVariable to be @.var3 in the raw editor

it says "error at.. the file name property is not valid. the filename is a device or contains invalid characters"

I have also tried @.var1 = c:\\temp

no dice

(and yes, c:\temp does exist)|||

Make sure you set the Value of @.var3 to be a valid fil path. The real value is used for validation purposes. The expression result is only really used at runtime. Any help?

|||The file will not exist until runtime, it is a raw file that gets created.

The file path "C:\temp\" is valid

Bizarrely, if I hardcode the value of c:\temp\filename.raw

It works. (not evaluating the var)

It doesn't seem to like evaluating the concatenation of the the vars.|||

adolf garlic wrote:

I can't get this working

@.var1 = c:\temp
@.var2 = output.raw
@.var3 = @.var1 + @.var2 [evaluate as expression set to true]

it won't let me select the raw output filenameVariable to be @.var3 in the raw editor

it says "error at.. the file name property is not valid. the filename is a device or contains invalid characters"

I have also tried @.var1 = c:\\temp

no dice

(and yes, c:\temp does exist)

@.var1 should be c:\temp\, not c:\temp. Either that, or in your concatenation you must contain the slash there.

You did tell the Raw File adapter to use a filename from a variable, correct?

|||It is C:\temp\

The RFA has access mode set to "File name from variable" which then allows me to select the variable from the drop down by "fileNameVariable"

I notice from another example on the web that it should be evaluating the expression and displaying the result in the 'value' property.

This is not happening for me.

a-ha!

The reason it is not working is because I was putting the @...+@... in the 'value' in the variables window.

I have discovered in the properties window for the variables window (shurely a window on a window too far, yesh?) a field called 'expression' in which I have to put the @.+@. bit.

This doesn't make sense.

Either have a flag called "evaluate as expression" OR have an "expression" property.

What is the point in having both?|||

At first, this seemed counter intuitive to me as well.. but, if you think about it a bit more it makes sense. The expression property will open up the window where you define the expression to evaluate. When you evaluate the expression it's result will go into the value field (try clicking the evaluate expression, it populates the other field). The two are properties are logically not the same and therefore should be seperate.

Are you having any problems with this now? It sounds like you have gotten it working again...

|||Yes, thankyou it is working!

My point is: if there is a value in the 'expression' property, it must be able to detect that it should evaluate the expression.

The reporting services model is much more intuitive. For starters, anything can have an expression which is based on vb code.

So if this was in RS, under the Raw.filename property, you would click on "..." to go straight to the expressions editor where you could pick from @.var1 etc.

Why have "expression","value","evaluate as expression" when you can just have value. (make everything an expression just like RS)

This is another example of something that is not intuitive and overly complex. I have once again wasted a lot of my and other people's time with something in SSIS.

No comments:

Post a Comment