Skip to main content
Solved

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

  • March 30, 2022
  • 1 reply
  • 191 views

carmijo
Supporter
Forum|alt.badge.img+11

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

 

Best answer by daveatsafe

Hi @carmijo​,

To remove both quotes, please try the following expression:

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

 

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.

1 reply

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • 1637 replies
  • Best Answer
  • March 30, 2022

Hi @carmijo​,

To remove both quotes, please try the following expression:

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