cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

how to find the position of a substring in a string?

Jump to solution

Is it possible to get the position of a substring in a string on a form?

Has anyone ever needed this and succeed in finding a solution?

 

thank you

adriana

Labels: (3)
Reply
4 Replies
Workflow Hero

Re: how to find the position of a substring in a string?

Jump to solution

Vadim Tabakman has a post about this for the workflows - Nintex Workflow - InStr Inline Function - Vadim Tabakman

There have been talks about adding this as a feature within nintex as well, please vote here if you feel like:A fn-find() so that you can find the first position of a character or string. – Customer Feedback fo...

In the form, if you can try to perform search() then you can use the below function:

function findstr()

{

var str = NWF$('#'+Sentence);

var n = str.search("my");

alert(n.val());

}

where Sentence is the returned ID from the text field and the button to retrieve the value calls the function findstr().

Someone else would have more ideas about it.

0 Kudos
Reply
Workflow Hero

Re: how to find the position of a substring in a string?

Jump to solution

Thank you for this answer.

I really need this to be on the form... so the workflow will not help me, and I need to perform this search on a specific string- like a single line of text as the value i am looking for appears in more than one place on the form.

I have tried with the findstr() function but it doesn't work.

thank you

0 Kudos
Reply
Workflow Hero

Re: how to find the position of a substring in a string?

Jump to solution

Hi adriana

 

in Forms you can get the position using a formula:

my_text and my_substr are single line Textbox controls, the position is computed in a calculated value control with formula:

length(replace(my_text, my_substr + '.*', ''))

 

Kind regards

Manfred

Reply
Workflow Hero

Re: how to find the position of a substring in a string?

Jump to solution

it works!!!! thank you!!!!

it is wonderfulSmiley Happy

0 Kudos
Reply