Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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:
Wildcard-Lookup-between-two-tables
- Marcus
Maybe you could use a parametrized variable:
Variable That Acts Like a User-Defined Function
Dynamic Field Expressions with Variables
- Marcus
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.
Why can't you just use this?
='Number of calls since the '
&
Div(Month($(vStartDatum)) - 1 , 3) + 1)
&
'th quarter of '
&
Year($(vStartDatum))
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.
Then look at Marcus's response below. I think variable with parameters should be the answer
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:
Wildcard-Lookup-between-two-tables
- Marcus
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.
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