etltools.SetVariable / GetVariable seems to be adding a space

More
4 years 6 months ago #19023 by daniel.fung@xerox.com
I am using the etltools import for python as follows and there is a space that is appearing after etltools.GetVariable call.
Code:
import etltools name = 'daniel' etltools.WriteToLog('name = >' + name + '<' ) len1 = str(len(name)) etltools.WriteToLog('length of name : ' + len1) etltools.SetVariable('<MyName>',name) name_get=etltools.GetVariable('<MyName>') len2 = str(len(name_get)) etltools.WriteToLog('name from variale >' + name_get + '<') etltools.WriteToLog('length of name from variable : ' + len2) Result.Value = 1

The results are shown below

Information 3/24/2019 9:01:57 AM Preparing to execute: Test 1
Information 3/24/2019 9:01:57 AM Started
Information 3/24/2019 9:01:57 AM Executing:Test 1
Information 3/24/2019 9:01:57 AM Executing Set Variable:Set Variable
Information 3/24/2019 9:01:57 AM Success
Information 3/24/2019 9:01:57 AM Executing Script:Script
Information 3/24/2019 9:01:57 AM import etltools
Code:
import etltools name = 'daniel' etltools.WriteToLog('name = >' + name + '<' ) len1 = str(len(name)) etltools.WriteToLog('length of name : ' + len1) etltools.SetVariable('<MyName>',name) name_get=etltools.GetVariable('<MyName>') len2 = str(len(name_get)) etltools.WriteToLog('name from variale >' + name_get + '<') etltools.WriteToLog('length of name from variable : ' + len2) Result.Value = 1

Information 3/24/2019 9:01:57 AM Executing:Script
Information 3/24/2019 9:01:57 AM name = >daniel<
Information 3/24/2019 9:01:57 AM length of name : 6
Information 3/24/2019 9:01:57 AM name from variale > daniel<
Information 3/24/2019 9:01:57 AM length of name from variable : 7
Information 3/24/2019 9:01:57 AM Success
Information 3/24/2019 9:01:57 AM Executing Set Variable:Set Variable
Information 3/24/2019 9:01:57 AM Success
Information 3/24/2019 9:01:57 AM Finished

Please Log in or Create an account to join the conversation.

More
4 years 6 months ago - 4 years 6 months ago #19024 by daniel.fung@xerox.com
of course i can add a .strip() on the value after calling etltools.GetVariable(), but this is not a good solution.

import etltools

Code:
name = 'daniel' etltools.WriteToLog('name = >' + name + '<' ) len1 = str(len(name)) etltools.WriteToLog('length of name : ' + len1) etltools.SetVariable('<MyName>',name) name_get=etltools.GetVariable('<MyName>') name_get = name_get.strip() ## this is the strip call. len2 = str(len(name_get)) etltools.WriteToLog('name from variale >' + name_get + '<') etltools.WriteToLog('length of name from variable : ' + len2) Result.Value = 1 Information 3/24/2019 9:10:38 AM Executing:Script Information 3/24/2019 9:10:38 AM name = >daniel< Information 3/24/2019 9:10:38 AM length of name : 6 Information 3/24/2019 9:10:38 AM name from variale >daniel< Information 3/24/2019 9:10:38 AM length of name from variable : 6 Information 3/24/2019 9:10:38 AM Success Information 3/24/2019 9:10:38 AM Executing Set Variable:Set Variable Information 3/24/2019 9:10:38 AM Success Information 3/24/2019 9:10:38 AM Finished
Last edit: 4 years 6 months ago by daniel.fung@xerox.com.
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

More
4 years 6 months ago #19026 by admin
Thank you for the feedback. We will have a look at it for you.

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
4 years 6 months ago #19031 by admin
Status update: We have reproduced the problem

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
4 years 6 months ago #19036 by admin
Hi Daniel

The issue you reported was corrected in the latest release

Mike
ETL Architect

Please Log in or Create an account to join the conversation.