Solved

Help with syntax for String Replacer function to remove consecutive double quotes

  • 30 March 2022
  • 1 reply
  • 9 views

Badge +10

I'm parameterizing the first portion of a dataset path name inside a feature writer dataset parameter to allow easier transition from our development environment to production.

 

I've created the following published parameter.

published parameter settingsThe published parameter's Configuration parameter is set to display name = 'dev', value = ""//myhost.org/Scheduled on FME Server/DEV/dev_start_stop_report_data/""

 

When the dataset parameter in the feature writer transformer is set as shown below, the writer is unable to find the directory. The error below is returned

$(report_data_path)sa_output\start_stop_report.xlsx
ERROR |Excel Writer: Failed to save changes to the spreadsheet '""\myhost.org\Scheduled on FME\Server\dev_start_stop_report_data\""sa_output\start_stop_report_.xlsx'. Check that you have write permission to the file, it has no password protection and is not opened by another application. Error message is 'No such file or directory.'

There may be a better way to go about it, but I'm attempting to use a string replacer to remove the consecutive double quotes. When the string replacer is formatted as shown below, only one of the consecutive double quotation marks are removed rather than both. This results in the directory still not being found. I'm also noticing that one of the first forward slashes before my host is being removed from my published parameter value.

@ReplaceString($(report_data_path),\",,[FALSE])sa_output\start_stop_report.xlsx
Excel Writer: Failed to save changes to the spreadsheet '"\myhost.org\Scheduled on FME Server\DEV\dev_start_stop_report_data\"sa_output\start_stop_report_.xlsx'. Check that you have write permission to the file, it has no password protection and is not opened by another application. Error message is 'No such file or directory.'

Questions I have:

  1. is there an easier way to parameterize a portion of the directory for these feature writers?
  2. why is the first forward slash from my published parameter value being removed when the string replacer is used? how can i prevent this?
  3. how can i remove both consecutive double quotation marks from my path for this feature writer dataset parameter?

Thank you very much

 

icon

Best answer by daveatsafe 31 March 2022, 00:41

View original

1 reply

Userlevel 2
Badge +17

Hi @carmijo​,

To remove both quotes, please try the following expression:

@ReplaceRegularExpression($(report_data_path),\"+,,[FALSE])sa_output/start_stop_report.xlsx

 

Reply