0

我有一个用户可以输入文本的字段,我希望他们能够插入标签,例如

 <impact> 

或者

 <signature>

作为我想在哪里插入 html img 的表示。. 因此,如果我能以某种方式将该标签从文本字段中提取到一个可用于替换的变量中。如果我要写出过程,它会是这样的。

获取指定字段中每个标签的列表 通过列表循环跟踪它在文本中的位置 将标签设置为 var $tag = tagfound 替换标签

  Substitute (  texfield;  "<$tag>"; '<img src=\"cid:$tag\'>" ;

在这一点上,在我继续下一次迭代之前,我还会用 $tag 做其他事情

有谁知道这是否可能/如何实现?

4

4 回答 4

3

取2(感谢您的澄清):

由于您需要循环,因此您需要脚本或自定义函数。我将向您展示一个脚本,因为每个人都有脚本制作者(而您需要 FMPA 才能访问自定义函数)。

结果将在一个名为 $tag_list 的变量中,您可以在之后执行您想要的操作。

FileMaker 脚本屏幕截图

于 2010-11-24T20:50:20.173 回答
1

您可以使用 let 函数在 FileMaker 计算中分配变量:

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.

您还可以像使用脚本一样使用 let 进行多项更改,如下所示:

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.

)
于 2010-11-23T17:00:34.367 回答
0

您不需要“将标签用作变量”,如果事先知道标签,只需执行以下替换:

替换(文本;“<标签>”;“新值”)

您还可以嵌套多个替代品,请查看文档以获取详细信息。

于 2010-11-23T02:11:00.187 回答
0

也许这个自定义功能可能会有所帮助。

于 2010-11-23T22:07:40.240 回答