What am I missing?

Ken Ray kray at sonsothunder.com
Fri Feb 4 08:53:51 EST 2005


On 2/4/05 1:24 AM, "Cubist at aol.com" <Cubist at aol.com> wrote:

> sez ps1 at softseven.org:
> 
>>     if tSSPC = tSSSN77 then
>>       put tDHSSR into field "DSS"
>>     else
>>      put "Sorry, That isn't correct" into field "DSS"
>>   end if
>> 
>> I have the above code in a Rev stack
>> 
>> tSSPC & tSSSN77 are 2 numbers I'm comparing.  I have put them both in a
>> field and can see that they are the same in my test.
>> tDHSSR holds information *IF* the above 2 are the same
>>  field "DSS"  is the field the information (good or bad) is put in.''
>> But I'm getting "Sorry, That isn't correct" no matter what.
>> I hope some one can shed some lite on the deal.
>    Are you sure the handler which contains the above code, knows about those
> variables? As a debugging test, I'd suggest putting the line "answer tSSPC &
> return & tSSSN77" *just* before that IF statement. This will show you
> *exactly* 
> what Rev thinks it's working with. If *you* think Rev should be working with
> something else, hopefully this information will help you zero in on the
> problem.

Also, you may want to check to see if there are trailing returns or spaces
in the two numbers, which would make them *look* the same when viewed in
fields, but would obviously not be the same. One check might be to check the
length of the two numbers to see if they're the same ("length(tSSPC) =
length(tSSSN77)"). 

If you find you have some leading or trailing whitespace characters, you
might be interested in using my trim() function which is designed to get rid
of these things:

function Trim pWhat
  local tRetVal
  get matchText(pWhat,"(?s)\s*(\S.*\S)\s*",tRetVal)
  return tRetVal
end Trim

so you could do:

  if trim(tSSPC) = trim(tSSSN77) then
    ...

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list