Create Data Node - Removing Characters
I added a Create Data Node that included file path. When I run the node, it removes characters from the data as it was populated in the node.
One of the Characters it removes is a quote ". That makes sense. If you are using a comma delimiter that allows you to have commas between quote marks without Analyze trying to create additional columns, The problem is that it also removes the file slash mark \.
I have tried running this using both a comma delimiter and a tab delimiter both with and without quote marks. The results are the same with both approaches. Other characters are not being removed. Is there a way to keep the \ intact in the output?
INPUT
C:\MainFolder\Sub Folder\[(The-File_Name)].xls
"C:\MainFolder\Sub Folder\ [(The-File_Name)].xls”
OUTPUT
C:MainFolderSub Folder[(The-File_Name)].xls
-
Hi Shawn,
Some characters have special meaning within a Creat Data node as they are control characters for the formatting of the data.
It is necessary to have a second repeat of a double quote character for it to be interpreted as a literal double quote character.
If a data element contains the defult field delimiter character - a comma - then the data element text needs to be enclosed in double quotes:
If your data is tab-delimited the FieldDelimiter property should be set to \t in this case it is not necessary to have the data element enclosed in double quotes (provided it does not include any comma characters)
If the data elements include backslash characters, they must be escaped by including a second backslash character:
Regards,
Adrian
-
If your data is to be output in a single field and in a single record you could also consider using the Input Static node which does not interpret the text entered into the StaticData field. This means you would not need to escape the backslash characters
-
If you want to be able to choose a file with a File Picker dialogue rather than enter it manually, you can define a property on a Generate Data node (or a Transform node) and use the property substitution functionality to access the property value from within your Python script:
In this case the substitution of the File Name property is performed using {{^Property_Name^}}
As the value needs to be interpreted as a string the value is enclosed in double (or single) quotes "{{^Property_Name^}}"
The opening double quote is preceeded by the r character to indicate the string is 'raw' and Python should not interpret any special characters in the string e.g. backslash characters.
In this example the property substitution also includes an optional default value "{{^Property_Name=Default_Value^}}"
See the Help documentation for details of using derived property values
Please sign in to leave a comment.
Comments
4 comments