Search for string within a text fields
I have a excel sheet that I want to import in to Podio. I then want to search and return within one of the column, if a particular ID number is there.
Let me give an example:
If the the fields says "Hello my registration number is XYZ123455", I want to write short PHP code that would search for the string "XYZ" and then return XYZ + the following 6 numbers. So that the end result in my calculation would be XYZ123455.
Hopefully this makes sense and someone is able to help me.
Thank you in advance.
-
Hi Ottar,
Podio calculation fields use Javascript, not PHP. :)
I assume, the text ""Hello my registration number is XYZ123455" is in a text field.
This script should get what you want (even if there is text behind the number):
var text = @your text field name;
text.indexOf("XYZ") > -1 ? text.substring(text.indexOf("XYZ"),text.indexOf("XYZ")+9) : ""If XYZ is in the text then show XYZ+number, else show nothing (calc fields stays empty).
Rainer
-
Hi rainer
I need help you please.
I need to get "1" if I find the string "Box" and "0" if I dont find.
texto var: @All of Cód Tarifa.join ();
text.indexOf ("Box")> -1? text.substring (text.indexOf ("XYZ"), text.indexOf ("XYZ") + 9): "" (I dont understand this sentence, please help Rainer)
Thanks
Please sign in to leave a comment.
Comments
4 comments