Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rudywelvaert
Creator
Creator

What function to use to replace numbered key holders with series of values

Hi,

What function can I use to replace numbered key holders with a series of values.

Example.

UnknownFunction('Number of calls since  the {1}th quarter of {2}', 4, 2018)

results in the string: 'Number of calls since  the 4th quarter of 2018'

 

Thanks

 

R.W.

 

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

You mean: 'Number of calls since  the {1}th quarter of {2}' is the content of a field-value and {1} and {2} are just placeholder?

Then you could use mapsubstring() to replace all the parameters with a single function. See here the function and an (advanced) example:

MappingFunctions/MapSubstring

Wildcard-Lookup-between-two-tables

- Marcus

View solution in original post

11 Replies
sunny_talwar

Where exactly are you trying to do this? There might be other ways to do this... but there is no function like the one you mentioned above.
rudywelvaert
Creator
Creator
Author

Hi Stalwart1,

 

Thanks

Yes I could use the Replace function:

SET vStartDatum=Floor(Date( Today(), 'DD/MM/YYYY'));

Replace(Replace('Number of calls since  the {1}th quarter of {2}','{1}',Div(Month($(vStartDatum)) - 1 , 3) + 1),'{2}',Year($(vStartDatum)))

But I'm looking for one function, not nesting the Replace function

R.W.

sunny_talwar

Why can't you just use this?

='Number of calls since  the '
&
Div(Month($(vStartDatum)) - 1 , 3) + 1)
&
'th quarter of '
&
Year($(vStartDatum))
rudywelvaert
Creator
Creator
Author

Because I actually strongly simplified the real issue.
I have up to 15 parameters {1},  {2},  {3},  {4},  {5},  ... {14}, {15} and of the string in which they have to be replaced I have 5 different variations in two different languages.

 

sunny_talwar

Then look at Marcus's response below. I think variable with parameters should be the answer

marcus_sommer

You mean: 'Number of calls since  the {1}th quarter of {2}' is the content of a field-value and {1} and {2} are just placeholder?

Then you could use mapsubstring() to replace all the parameters with a single function. See here the function and an (advanced) example:

MappingFunctions/MapSubstring

Wildcard-Lookup-between-two-tables

- Marcus

rudywelvaert
Creator
Creator
Author

marcus_sommer,

 

thanks.

But it looks like this mapsubstring() is used in scripts.

I'm looking for a function used in expressions on text boxes, titles, ...

 

R.W.

marcus_sommer

I think in this case you will need multiple and/or nested expressions. Like already mentioned you could use parametrized variables to simplify it and keep the "ugly" expression within a variable.

But IMO you should do everything of this transformations within the script or at least the most important parts. I don't see much benefit to do it within the UI. You mentioned it should serve for some kind of adjustment for different languages and/or different formattings and therfore I think the following will be quite useful for you: Handling-Multiple-Languages.

- Marcus