How to count number of semicolon in the Textbox fi

2019-08-21 15:53发布

问题:

Field A Value Is : Test1;Test2;Test3;Test4

I need to count number of semicolon present in Field A Like : 3

its possible to do this without coding?

回答1:

Try this: Field A: Test1;Test2;Test3;Test4

Field B(default value): string-length(translate(FieldA, "1234567890ABCDEFGHIJKLMNOPQRSTVWXYZabcdefghijklmnopqrstuvwxyz", ""))

Result: 3

Translate function is to convert the other characters to blank(no space) and then using string-length to count the semicolons that are left.

EDIT: Created a blog post for this one for detailed explanation and steps.



标签: infopath