Question

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?

Was it helpful?

Solution

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.

FileMaker script screen shot

OTHER TIPS

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.

)

Maybe this custom function may help.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top