Hello @fabbstar
The preferred solution here would be use regular expressions, as follows:
if( /E1/i.test(fieldname83) ) return '30.00';
Best regards.
Hi!
Thank you so much for the reply and suggestion. It works great.
My only issue, is where the formula is close in characters, the system outputs the value for shortest string. As an example:
if( /E1/i.test(fieldname83) ) return ’30’;
if( /E10/i.test(fieldname83) ) return ’35’;
The above is contained in my calculated field, however, if ‘E10′ is entered into fieldname83, it returns the result ’30’ instead of ’35’. I presume, the top formula overrides the second one as it recognises the first two characters and returns the output for ‘E1’.
Is there a syntax I can add to the formula which addresses this?
S
Hello @fabbstar
You simply should inverse the order of instructions, from the more specific to more general:
(function(){
if( /E10/i.test(fieldname83) ) return 35;
if( /E1/i.test(fieldname83) ) return 30;
})()
Best regards.
Hey,
So simple! You genius.
Very last one…
I have a field (Single Line Text), I notice there is an option to add the option ‘Validate against a regular expression’. Is there a way I can use this option to ensure there is a space in the text field. For example, I need users to add a space between their post codes e.g. SE1 3DR. I was wondering if this validation option can through an error if the user inputs the post code without the space: e.g. SE13DR.
Many thanks again,
Simon
Hello @fabbstar
Yes of course, you can define the regular expression you want to validate the field’s values.
I’m sorry, but I can’t implement the users’ projects as part of support. You can find many tutorials for regular expressions on Internet, for example: Regular-Expressions.info
Best regards.
Hey, thanks for that.
Would this be something you can help me with, for a development fee?
Many thanks,
S
Hi! We’d like to help but we can’t reply about that in this forum. We are not allowed to support any customers in these forums.
For pro or commercial product support please contact us directly on our site. This includes any pre-sales topics or customization as well.
Commercial products are not supported in these forums. We will happily answer this and any other questions you can have on our own site.
Thank you.
Hey,
I understand, thanks for that.
I have found the regular expression online, thanks again for the great plugin and support.
S