如何在字段中使用字符串在filemaker中创建变量

时间:2010-11-22 17:47:37

标签: filemaker

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

这样的标签
 <impact> 

 <signature>

表示我想插入html img的位置。 。因此,如果我能以某种方式从文本字段中提取该标记到我可以用于替换的变量。如果我要写出这些过程就会是这样的。

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

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

此时我还会使用$ tag做其他事情,然后再进行下一次尝试

任何人都知道这是否可能/如何实现这一目标?

4 个答案:

答案 0 :(得分:3)

拿2(感谢澄清):

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

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

FileMaker script screen shot

答案 1 :(得分: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.

)

答案 2 :(得分:0)

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

替换(text;“&lt; tag&gt;”;“newvalue”)

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

答案 3 :(得分:0)

也许this custom function可能会有帮助。

相关问题