Page 2 of 2

Posted: Tue Jun 26, 2007 9:46 am
by kcbland
Please use code tags so that formatting is preserved. I think I see the issue with your changes, but please re-paste with tags.

Posted: Tue Jun 26, 2007 11:49 am
by DS4DRIVER

Code: Select all

      PRECISION 14
      DataIn1 = TRIM(Arg1)
      DataIn2 = TRIM(Arg2)


      If (IsNull(DataIn1) and Not(IsNull(DataIn2))) or (IsNull(DataIn2) and Not(IsNull(DataIn1))) Then
         Ans = @TRUE
      End Else
         If IsNull(DataIn1) and IsNull(DataIn2) Then
            Ans = @FALSE
         End Else
            If (Not(NUM(DataIn1)) and NUM(DataIn2)) Or (Not(NUM(DataIn2)) and NUM(DataIn1)) Or (Not(NUM(DataIn1)) and Not(NUM(DataIn2))) Then
               If DataIn1 = DataIn2 Then
                  Ans = @FALSE
               End Else
                  Ans = @TRUE
               End
            End Else
               If SCMP(DataIn1,DataIn2) = 0 Then
                  Ans = @FALSE
               End Else
                  Ans = @TRUE
               End
            End

         End

      End

Posted: Tue Jun 26, 2007 12:19 pm
by ray.wurlod
Did you try

Code: Select all

Compare(DataIn1, DataIn2, "R") 
?

Posted: Tue Jun 26, 2007 2:05 pm
by DS4DRIVER
Compare does not work in a situation where the args compared are numbers like 2335567.7700000000 and 2335567.77

Posted: Tue Jun 26, 2007 4:01 pm
by kcbland
This may be a cleaner way of expressing the logic:

Code: Select all

      PRECISION 14 

      DataIn1 = TRIM(Arg1) 
      DataIn2 = TRIM(Arg2) 

      Begin Case
      Case (IsNull(DataIn1) and Not(IsNull(DataIn2))) or (IsNull(DataIn2) and Not(IsNull(DataIn1)))
         Ans = @TRUE 
      Case IsNull(DataIn1) and IsNull(DataIn2)
         Ans = @FALSE 
      Case NOT(NUM(DataIn1) and NUM(DataIn2))
         If DataIn1 = DataIn2 Then Ans = @FALSE Else Ans = @TRUE 
      Case NUM(DataIn1) and NUM(DataIn2)
         If SCMP(DataIn1,DataIn2) = 0 Then Ans = @FALSE Else Ans = @TRUE 
      Case @TRUE
         Ans = @FALSE
      End Case

Posted: Tue Jun 26, 2007 4:50 pm
by ray.wurlod

Code: Select all

PRECISION 14 

      DataIn1 = TRIM(Arg1) 
      DataIn2 = TRIM(Arg2) 
      IsNull1 = IsNull(DataIn1)
      IsNull2 = IsNull(DataIn2)

      Begin Case 
      Case IsNull1 + IsNull2 = 1  ; * either is null but not both
         Ans = @TRUE 
      Case IsNull1 + IsNull2 = 2  ; * both are null
         Ans = @FALSE 
      Case NOT(NUM(DataIn1) and NUM(DataIn2)) 
         Ans =  (DataIn1 <> DataIn2 )
      Case NUM(DataIn1) and NUM(DataIn2) 
         Ans = (SCMP(DataIn1,DataIn2) <> 0)
      Case @TRUE 
         Ans = @FALSE 
      End Case

Posted: Wed Jun 27, 2007 2:57 pm
by DS4DRIVER
I am not able to see the full contents of the reply that Ken and Ray posted.

Posted: Wed Jun 27, 2007 3:35 pm
by ray.wurlod
Premium membership is only a few cents per day, and is totally devoted towards paying for the bandwidth charges for DSXchange. With premium membership you WILL be able to see all of the premium posters' posts.