Reputation: 17640
I have a field where the user can input text and I want them to be able to insert tags like
<impact>
or
<signature>
as representation of where I would like to insert an html img. . So if I can somehow extract that tag from the text field into a variable that I can use for the substitution. If I were to write out the processes it would be like this.
get a list of every tag in the specified field loop through the list keeping track of where it is in the text set the tag to a var $tag = tagfound substitute the tag
Substitute ( texfield; "<$tag>"; '<img src=\"cid:$tag\'>" ;
and at this point I would also do other things with the $tag before i went on to the next itteration
anyone know if this is possible /how to make this happen?
Upvotes: 0
Views: 546
Reputation: 136
You don't need to "use the tags as variables", if the tags are known in advance just do a Substitute like:
Substitute ( text ; "<tag>" ; "newvalue" )
You can also nest multiple substitutes, check the docs for details.
Upvotes: 0
Reputation: 2239
Take 2 (thanks for the clarification):
Since you need to loop, you need either a script or a custom function. I'll show you with a script since everyone has scriptmaker (whereas you need FMPA to get access to custom functions).
The result will be in a variable called $tag_list which you can do what you want with afterwards.
Upvotes: 3
Reputation: 2239
You use the let function to assign variables in a FileMaker calculation:
Let (
[
$impact = '<impact>';
$signature = '<signature>' // Notice that the semi-colon is on the next line and not this one.
];
Substitute ( textfield; $impact; 'replacement text')
) // End Let function.
You can also use let as sort of like a script to make multiple changes like so:
Let (
[
$impact = '<impact>';
$signature = '<signature>';
$impact_replaced = Substitute ( textfield; $impact; 'replacement text');
$signature_replaced = Substitute ( $impact_replaced; $signature; 'replacement text')
];
$signature_replaced // This is the return value from the calculation.
)
Upvotes: 1