SSIS connection expression problem - ssis

Im trying to use an expression to a sub package in SSIS however it always errors out stating that it cannot find the dtsx file. Ive copied the path to explorer and it seems to be correct.
The error also states that expression cannot be written to the property. My code is below.
#[User::vRoot] + "\Employees.dtsx" with #[User::vRoot] being a variable stored in SQL
Any Ideas

Try to escape the backslash in the expression using an additional backslash.
#[User::vRoot] + "\\Employees.dtsx"
In such a scenario where I need to concatenate folder and file name, I always do it this way. I usually create two variables named FolderPath and FileName. Let's assume FolderPath contains C:\temp\ (make sure it ends with a back slash) and FileName contains Employees.dtsx.
I will create a third variable named FilePath and will set the EvaluateAsExpression property of this variable to true. I will set the following expression in this variable so it dynamically evaluates the value.
#[User::FolderPath] + #[User::FileName]
Hope that helps.

Backslash is an escape character here, so if you want to represent a literal backslash, it's "\\".
I also suggest, as a general rule, instead of hardcoding a backslash in the string concatenation, to use this method to consider potential trailing backslashes in the first variable:
#[User::vRoot] + (RIGHT(#[User::vRoot], 1) == "\\" ? "" : "\\") + "Employees.dtsx"

Related

How do I give a database path to ODBC Microsoft Access Driver with ampersand in it?

My database path name has an ampersand in it. "...\mthly calcs & projections...".
Unfortunately, the path name cannot be changed. How do I deal with this case? Is there a way to specify the database path to the driver so it accepts the path with an ampersand? Maybe escaping it somehow or encoding it differently?
In the connection string if I use "&" doesn't work because ";" is interpreted as an option delimiter.
"jdbc:easysoft:mdb?DBQ=...\\mthly calcs & projections\\...\\Databases\\myDatabase.accdb;ExtendedAnsiSQL=1;READONLY=False;EXCLUSIVE=True"
I tested it by changing the path name by replacing the "&" with "and" and it works fine. Unfortunately in the production version the path names are fixed and I can't change them to remove the "&".
Escaping the ampersand should work:
"jdbc:easysoft:mdb?DBQ=...\\mthly calcs \& projections\\...\\Databases\\myDatabase.accdb;ExtendedAnsiSQL=1;READONLY=False;EXCLUSIVE=True"

How to use UPDATE in MySQL with string containing escape characters

please look here:
UPDATE cars_tbl
SET description = '{\rtf1'
WHERE (ID=1)
Description field is "blob", where my RTF document is to be stored.
When I check updated data I always find
{
tf1
\r simply disapears. I tried to find solution on the web, but no success. My rtf files are corrupted on many places, because the escape characters used in the string are substituted. How to suppress this substitution and update field with string as is?
Thanx for advice
Lyborko
Backslash is an escape character, so to keep it you need a double backslash:
UPDATE cars_tbl
SET description = '{\\rtf1'
WHERE (ID=1)
As an aside \r is a carriage return.. and it hasn't disappeared in your data; it is responsible for tf1 appearing on the line below the {.
You can achieve this with a more generic approach
use of QUOTE() in mysql
MySQL QUOTE() produces a string which is a properly escaped data value in an SQL statement, out of an user supplied string as argument.
The function achieve this by enclosing the string with single quotes, and by preceding each single quote, backslash, ASCII NUL and control-Z with a backslash.
example
UPDATE cars_tbl
SET description = QUOTE('{\rtf1')
WHERE (ID=1)
UPDATE
to escape your RTF you can also just use REPLACE this way all your \ will become \\
Example
UPDATE cars_tbl
SET description = REPLACE('{\rtf1', '\', '\\')
WHERE (ID=1)

No keyword with name '=' found in robot

I'm writing a test case in robot framework. I'm getting the response in below json string:
{"responseTimeStamp":"1970-01-01T05:30:00",
"statusCode":"200",
"statusMsg":"200",
"_object":{"id":"TS82",
"name":"newgroup",
"desc":"ttesteste",
"parentGroups":[],
"childGroups":[],
"devices":null,
"mos":null,
"groupConfigRules" {
"version":null,
"ruleContents":null
},
"applications":null,"type":0
}
}
From that I want to take "_object" using:
${reqresstr} = ${response['_object']}
... but am getting the error "No keyword with name '=' found" error
If I try the following:
${reqresstr}= ${response['_object']}
... I'm getting the error "Keyword name cannot be empty." I tried removing the '=' but still get the same error.
How can I extract '_object' from that json string?
When using the "=" for variable assignment with the space-separated format, you must make sure you have no more than a single space before the "=". Your first example shows that you've got more than one space on either side of the "=". You must have only a single space before the = and two or more after, or robot will think the spaces are a separator between a keyword and argument.
For the "keyword must not be empty" error, the first cell after a variable name must be a keyword. Unlike traditional programming languages, you cannot directly assign a string to a variable.
To set a variable to a string you need to use the Set Variable keyword (or one of the variations such as Set Test Variable). For example:
${reqresstr}= Set variable ${response['_object']}
${reqresstr}= '${response["_object"]}'
wrap it inside quotes and two spaces after =
There is a syntax error in your command. Make sure there is a space between ${reqresstr} and =.
Using your example above:
${reqresstr} = ${response['_object']}

Data Driven Subscription Special Characters needed in File Name

I have a data driven subscription with the file name as one of the columns in the object that SSRS uses to fulfill the subscription.
The file name is the subject of the report. I have tested this a few ways and the error is happening with the file name, not when I pass the item as a parameter.
For example, the report as a single Parameter, Item.
The report is written to a file share:
Path: \\directory\store
Parameter: Item=Blue&White
File Name: Blue&White.pdf
I have tried substituting the "&" with other characters, and of course it works, but it is really important for the file to be named Blue&White.pdf
Any suggestions are appreciated.
I think it is interpreting the '&' as an argument separator as application/x-www-form-urlencoded.
You may want to consider different encoding of the Unicode Character 'AMPERSAND' (U+0026). However since '&' is used as an escape character you options may be limited.
&
%26
\u0026
I am using a data driven subscription and used the SQL command to set the filename. The REPLACE function was used to change '&' to 'and'.

Expression issue in SSIS

I have a string like this format. In my case I need to extract only the characters from string case
1)12AB
2)SD12
3)1WE4
output
1)AB
2)SD
3)WE
I need to extract only the characters. I am using this expression in the derived column in SSIS package
SUBSTRING(MediaIDCode,1,2)
but this expression works for only this condition
1)12AB
I need to get an expression that works for all the conditions above. I have tried using REPLACE ( '' , '1', '') but it becomes a big expression.
The SUBSTRING function code you've posted will extract characters from a string without considering their content.
Have a look at using Regular Expressions to filter out unwanted characters:
http://consultingblogs.emc.com/jamiethomson/archive/2005/07/04/SSIS-Nugget_3A00_-The-script-component-and-regular-expressions.aspx
You could also use a synchronous script transformation to filter characters this way:
Dim NewMediaIDCode As String = ""
For Each c As Char In Row.MediaIDCode
If Not Char.IsDigit(c) Then
NewMediaIDCode += c
End If
Next
Row.MediaIDCode = NewMediaIDCode
I've used the IsDigit method here, but there's plenty of other methods to choose from.