Quantcast
Viewing all articles
Browse latest Browse all 9238

Re: UDF doubt

Hi Sruthi,

I think it is a little logic confussion.

 

if( (refDescr.indexOf("UT") != -1) && (refDescr != "") ) {

The second part is unneccesary although this is not part of the problem. Why unnecessary?, i hope to explain it right:

String  with UT in any part of the string -> you have 1 AND 1 = 1

String wihout UT in any part of the string not empty-> you have: 0 AND 1= 0

Empty String -> you have 0 AND  0 = 0

Summing up if you don't have UT in the string always return 0, then do it easier and ommit the second part.

 

   if( (refDescr.startsWith("(UT") || refDescr.startsWith("UT(")) &&  (refDescr.indexOf(',') != -1 ))

I thin the problem is here.

String  with (UT at beggining of the string -> ( 1 OR 0) AND 0 (because you haven't any dot in your examples) = 0

String  with UT( at beggining of the string -> ( 0 OR 1) AND 0 (because you haven't any dot in your examples) = 0

 

Then try to set the equal sign in the second part:  if( (refDescr.startsWith("(UT") || refDescr.startsWith("UT(")) &&  (refDescr.indexOf(',') == -1 ))

 

Hope this helps.

Regards.


Viewing all articles
Browse latest Browse all 9238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>