Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select
Message
From
10/08/2008 04:43:47
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Select
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01336783
Message ID:
01337881
Views:
7
hi,

thank you for reply and help,

i need to make code as below at event interactivchange for text1,text2,text3 and text4,
    SET EXCLUSIVE off
    SET EXACT on
  
     
             lcName1 = alltrim(thisform.text1.value)
             lcName2 = alltrim(thisform.text2.value)
             lcName3 = alltrim(thisform.text3.value)
             lcName4 = alltrim(thisform.text4.value)
            
IF lcName1=="" AND lcName2 ==""   AND lcName3 =="" AND lcName4<>""
      if LEN(ALLTRIM(thisform.text4.value)) >= 3
     Select F4,F1,name4,name3,name2,name1 from x2 where  name4=lcName4;
                                  into cursor lcResultTable
                                  
                                     
              ************************************************                    
      if LEN(ALLTRIM(thisform.text3.value)) >= 3 and LEN(ALLTRIM(thisform.text4.value)) >= 3
                                  
       IF  lcName1 ==""   AND lcName2 =="" AND lcName3<>""  AND lcName4<>""
       
        Select F4,F1,name4,name3,name2,name1 from x2 where   name3=lcName3 AND name4=lcName4;
                                  into cursor lcResultTable
                                  
                             ********************************************
if LEN(ALLTRIM(thisform.text3.value)) >= 3 and LEN(ALLTRIM(thisform.text4.value)) >= 3 and LEN(ALLTRIM(thisform.text2.value)) >= 3 
                                  
       IF  lcName1 ==""   AND lcName2 <>"" AND lcName3<>""  AND lcName4<>""
       
        Select F4,F1,name4,name3,name2,name1 from x2 where  name2=lcName2 and name3=lcName3 AND name4=lcName4;
                                  into cursor lcResultTable
                                  ***********************************************
  if LEN(ALLTRIM(thisform.text3.value)) >= 3 and LEN(ALLTRIM(thisform.text4.value)) >= 3 and LEN(ALLTRIM(thisform.text2.value)) >= 3 AND LEN(ALLTRIM(thisform.text1.value)) >= 3
                                  
       IF  lcName1 <>""   AND lcName2 <>"" AND lcName3<>""  AND lcName4<>""
       
        Select F4,F1,name4,name3,name2,name1 from x2 where   name1=lcName1 AND name2=lcName2 and name3=lcName3 AND name4=lcName4;
                                  into cursor lcResultTable  NOFILTER
                                 


              ENDIF
              ENDIF
              ENDIF
              ENDIF
              ENDIF
              ENDIF
              ENDIF
              ENDIF        
   

          
GO top
  thisform.Grid1.RecordSource="lcResultTable"
          thisform.grid1.Visible=.t.          
  
  
thanks for help

>>I had a typo in my program, I wrote Endif instead of Endfor. Also I suggest that you change == to =. This modified version works as you describe. If one or more of lxNameX match any of the nameX fields, you have a match.
>>lcFromTable='x2'
>>lcResultTable='crsMyCursor'
>>For x=1 to 4
>>   lcName=Evaluate('lcName'+Transform(x))
>>   If !Empty(lcName)
>>      Select * from (lcFromTable) where name1=lcName or name2=lcName or name3=lcName or name4=lcName into cursor (lcResultTable) READWRITE
>>      lcFromTable=lcResultTable
>>   EndIf
>>EndFor
>>NB! I tested it this time. :-)
>
>Nice! You can, of course, write it as one long select too, e.g.
>
>  Select * from (lcFromTable) where (m.lcName1=="" OR (name1=lcName1 or name2=lcName1 or name3=lcName1 or name4=lcName1) )
>AND ((m.lcName2=="" OR (name1=lcName2 or name2=lcName2 or name3=lcName2 or name4=lcName2) )
>AND ...
>
>
>into cursor (lcResultTable)
>
>BTW, you can exit out of the loop once you get no result, you need to add a check for this.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform