问题
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.
来源:https://stackoverflow.com/questions/31561609/how-to-count-number-of-semicolon-in-the-textbox-field-in-infopath-2013