Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identify fields where values are different between recor
Message
From
21/09/2005 10:02:22
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
21/09/2005 09:43:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01051585
Message ID:
01051629
Views:
10
Got it. In your original reply you mixed up using lcGrpBy and lcGroupBy. Worked great once I changed that. Thanks!

>Jay,
>It says select those where sum(_source) is not 3. Same as != 3 or <> 3 (if all fields match sum would be 1+2=3). Here is a test code:
>
>Select * From customer Into Cursor c1 Readwrite
>Select c1
>Browse Title "Modify some records-Compnay,Contact,Cust_id fields only"
>Select Cust_ID, Company,Contact From customer Into Cursor c2 Readwrite
>Select c2
>Browse Title "Modify some records"
>
>
>Afields(aT1,'c1')
>Afields(aT2,'c2')
>lcCommonFields = ''
>For ix=1 To Alen(aT1,1)
>  If Ascan(aT2, aT1[m.ix,1], 1,-1,1,1+2+4+8) > 0
>    lcCommonFields = m.lcCommonFields + ;
>      Iif(Empty(m.lcCommonFields),'',',')+;
>      aT1[m.ix,1]
>  Endif
>Endfor
>
>Select 1 As _Src,&lcCommonFields From c1 ;
>  union ;
>  Select 2 As _Src,&lcCommonFields From c2 ;
>  into Cursor CrsU
>
>lcGrpBy = ''
>For ix=2 To Fcount()
>  lcGrpBy = m.lcGrpBy + Iif(Empty(m.lcGrpBy),'',',')+Transform(m.ix)
>Endfor
>
>Select * From CrsU ;
>  having Sum(_Src) # 3 ;
>  group By &lcGrpBy
>
This would work under VFP7 or with "set enginebehavior 70" in 8 and up.
>If source is not important you might slightly change code:
>
>Select 1,&lcCommonFields From CrsU ;
>  having Sum(_Src) # 3 ;
>  group By 1,&lcGrpBy
>
Cetin
>
>
>>I just knew you were going to be the one to answer this!
>>
>>I'm ok up until the last line. I think the "# 3" is causing a syntax error. What does that do?
>>
>>
>>>>Have two tables that have some of the same fields. I want to look at a specific record in table 1 and find out what field values are not the same as table 2. I don't care about fields that are not the same between the tables. The fields may or may not be in the same order within the two tables. Any thoughts?
>>>
>>>Using afields() you could create a string for the common field list - (say lCCommonFields: "f1,f2,f3").
>>>
>>>
>>>select 1 as _source,&lcCommonFields from t1 ;
>>>union ;
>>>select 2 as _source,&lcCommonFields from t2 ;
>>>into cursor temp nofilter
>>>
>>>lcGrpBy = ''
>>>For ix=2 To Fcount()
>>>  lcGrpBy = m.lcGrpBy + Iif(Empty(m.lcGrpBy),'',',')+Transform(m.ix)
>>>Endfor
>>>
>>>select * from temp ;
>>>  having sum(_source) # 3 group by &lcGroupBy
>>>
>
>Update: VFP and up compatible version:
>
>lcGrpBy = ''
>For ix=2 To Fcount()
>  lcGrpBy = m.lcGrpBy + Iif(Empty(m.lcGrpBy),'',',')+Transform(m.ix-1)
>Endfor
>
>
>Select &lcCommonFields From CrsU ;
>  having COUNT(*) = 1 ;
>  group By &lcGrpBy
>
>Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform