May 17, 2007 at 10:12 am
Has anyone tried to use the functions listed in the upper right hand corner of an Expression Builder? I have tried time and time again, in different tasks with different variables, to get the functions to work and always get an error when I hit Evaluate Expression or try to close the Builder.
Usually the error reads "Expression cannot be evaulated. Additional information: The expression contains unrecognized token "X". If "X" is a variable, it should be expressed as "@X". The specified token is not valid. If the token is intended to be a variable name, it should be prefixed with the @ symbol. Attempt to parse the expression "X" failed and returned error code .... The expression cannot be parsed. it might contain invalid elements or it might not be well-formed. There may also be an out-of-memory error"
This is driving me nuts.
My current example is that I'm trying to set a dynamic email subject in the Send Mail task. I've got a date variable that I'm appending to a string. This works fine. But if I pull down the DateAdd function to change the date variable, it freaks out. Not on the variable part, but on the date part. DateAdd(dd, -1, @User[TodaysDate]) gives an error message telling me "dd" needs to be "@dd" if it's a variable. HUH?
I don't want to 2 date variables, 1 to determine the date on the email subject (yesterday's date) and the other (today's date) for the processing part. Any thoughts on how I can use just one and get the DateAdd to work in the Expression Builder?
July 11, 2011 at 8:23 am
I was just having trouble with this myself. Try putting quotes on the datepart variable ("d" instead of dd).
July 11, 2011 at 4:12 pm
ijjoycemail (7/11/2011)
I was just having trouble with this myself. Try putting quotes on the datepart variable ("d" instead of dd).
This would be at least part of the problem, the date types in the expression builder are not actually special data types like they are in SQL. So when ever you're using date types in expression builder it's expecting a string for the date type, so either a variable or a "dd".
July 13, 2011 at 2:30 pm
The "dd" simply refers to what type of date value you want. And unlike T-SQL the value needs double quotes.
Another "gotcha" is sometimes the string wants a string value, sometimes not. So you may have to cast the result into a str or wstr to get it to take.
Expression language has a lot of quirks but eventually you get through the common ones.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply