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

发布于 2024-10-03 19:03:53 字数 470 浏览 14 评论 0原文

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

 <impact> 

 <signature>

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

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

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

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

有人知道这是否可能/如何实现这一点?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

别念他 2024-10-10 19:03:53

采取2(感谢您的澄清):

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

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

FileMaker 脚本屏幕截图

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

小兔几 2024-10-10 19:03:53

您可以使用 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.

)

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.

)
£噩梦荏苒 2024-10-10 19:03:53

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

Maybe this custom function may help.

ゃ人海孤独症 2024-10-10 19:03:53

您不需要“使用标签作为变量”,如果预先知道标签,只需执行替换,例如:

Substitute ( text ; "" ; "newvalue" )

您还可以嵌套多个替换,请检查有关详细信息,请参阅文档。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文