Skip to main content
Question

String concatenator not writing correct string

  • February 9, 2018
  • 3 replies
  • 23 views

bubblebeb
Contributor
Forum|alt.badge.img+6

I am using a string concatenator to
write batch files for me.

I am entering a windows path in the string concatenator (see
below).

%SendKeys% "E:\FME\Development Work\Timesheet
Analysis\Output\@Value(HomeTeamFP)\@Value(Name) @Value(DateFrom) to @Value(DateTo){ENTER}"

But the string it writes out is 

%SendKeys% "E:\FME\Development Work\Timesheet
Analysis/Output\RUR370\Amy Hutsby 2018-01-01 to 2018-01-31{ENTER}"

I.e. it changes to ...Analysis\Output... to
...Analysis/Output... 

This then leads the batchfile to fail to work. 

It has happened several times and I dont know what is
causing it or how to fix it. 

Any ideas from anyone? 

Thanks

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

davideagle
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 578 replies
  • February 9, 2018

Hi Seb, An absolute hack is to follow it with a StringReplacer that swaps / to \\, it's a hack that solves the problem short term. Slashes are definitely a challenge frequently and its because they are a bit "special" especially as they sometimes need to be reversed for Linux. I suspect someone else has a much more slid explanation of why this might be happening though.


bubblebeb
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 52 replies
  • February 9, 2018

Hi Seb, An absolute hack is to follow it with a StringReplacer that swaps / to \\, it's a hack that solves the problem short term. Slashes are definitely a challenge frequently and its because they are a bit "special" especially as they sometimes need to be reversed for Linux. I suspect someone else has a much more slid explanation of why this might be happening though.

Thanks Dave. I hadnt thought of that. Good short term fix.

 

Cheers

 

 

 


Forum|alt.badge.img
  • 48 replies
  • February 10, 2018

I tend not to use string transformers as I use python callers

HomeTeamFP = feature.getAttribute('HomeTeamFP')
DateFrom= feature.getAttribute('DateFrom')
DateTo= feature.getAttribute('DateTo')

#or if parameter 
Name = FME_MacroValues['Name']

fullstring = '%SendKeys% "E:\FME\Development Work\TimesheetAnalysis\Output\{}\{} {} to {}{{ENTER}}"'.format(HomeTeamFP,Name,DateFrom,DateFrom)

feature.setAttribute('BatFile',fullstring)

could in fact write the bat files in python too