Please Sir, More help sir....(with set relation)....

Please Sir, More help sir....(with set relation)....

Post by Richard Hollingswor » Thu, 27 Mar 1997 04:00:00



select a
use employee order ssn
Ok, here's the snippet...

select b
use absence

set relation to ssn into a
set skip to employee

scan
        replace vac_grant with a.vac_ent
endscan

close all

What I want this code to do is, scan thru the table in area b ssn by ssn;  
when it finds a corresponding ssn in the table in area a, replace the field
called vac_grant in area b with the value in field vac_ent in area a.

This set relation stuff is real confusing, and I would GREATLY appreciate any
help with this one.

Thanx much, RH

 
 
 

Please Sir, More help sir....(with set relation)....

Post by Bob Rupl » Thu, 27 Mar 1997 04:00:00



> select a
> use employee order ssn
> Ok, here's the snippet...

> select b
> use absence

> set relation to ssn into a
> set skip to employee

> scan
>         replace vac_grant with a.vac_ent
> endscan

> close all

> What I want this code to do is, scan thru the table in area b ssn by ssn;
> when it finds a corresponding ssn in the table in area a, replace the field
> called vac_grant in area b with the value in field vac_ent in area a.

> This set relation stuff is real confusing, and I would GREATLY appreciate any
> help with this one.

You've got it right except you don't need the SET SKIP TO. That's for
one-to-many relationships.  For example in a report, where the "one" is
printed in the header and the "many" is printed in the detail.

And BTW you could change the:

 scan
    replace vac_grant with a.vac_ent
 endscan

to

 replace all absence.vac_grant with employee.vac_ent

--
Bob Ruple
http://www.ix.netcom.com/~bruple

 
 
 

Please Sir, More help sir....(with set relation)....

Post by spam_bl.. » Sat, 29 Mar 1997 04:00:00




>select a
>use employee order ssn
>Ok, here's the snippet...

>select b
>use absence

>set relation to ssn into a
>set skip to employee

>scan
>    replace vac_grant with a.vac_ent
>endscan

>close all

>What I want this code to do is, scan thru the table in area b ssn by ssn;  
>when it finds a corresponding ssn in the table in area a, replace the field
>called vac_grant in area b with the value in field vac_ent in area a.

>This set relation stuff is real confusing, and I would GREATLY appreciate any
>help with this one.

First thing I would suggest is get rid of the a,b,c,d,e stuff. After you get
deep into a program with workareas open all over the place, a,b,c,d,e,f,g or
1,2,3,4,5,6,7 becomes real meaningless real fast.

Now, I'm trying to figure out the makeup of your files. Is this a many to many
relationship? Are there many employee records for each absence and many
absences for each employee? SSN implies to me that the employee records are
unique, and that there may be many absences for each employee but not the other
way around.

Your code, however suggests that the relationship is 1 to 1. If not, then if
the employee ssn's are unique, every time you run into a new absence record for
the particular employee, you will simply overwrite what you just wrote into the
employee record from the last absence record.

If the code really is 1 to 1, then the 'set skip' is not required, and your
code then is generally correct. Add an [if !eof(childtable)] - see below.

If the relationship is 1 to many - employee to absence, then do it the other
way around.

select employee
set skip to absence

scan
   if !eof('absence')
      replace absence.vac_grant with employee.vac_ent in 'employee'
   endif
endscan

If I have not thoroughly confused you, then I'd very much appreciate it if you
would please explain it to me. ;)

Alan


but I'm sick of email spam.

 
 
 

Please Sir, More help sir....(with set relation)....

Post by Anders Altbe » Sat, 29 Mar 1997 04:00:00


Quote:>> What I want this code to do is, scan thru the table in area b ssn by

ssn;   when it finds a corresponding ssn in the table in area a, replace
the field  called vac_grant in area b with the value in field vac_ent in
area a. <<

set order to ssn in employee
select absence
replace vac_grant with employee.vac_ent ;
 for seek(ssn,'employee')

You don't need a relation to do this but if you want to this works:
select employee
set order to ssn in absence
set relation to ssn into absence
set skip to absence
repla all absence.vac_grant with vac_ent

-Anders

--

03/28/97 13:17
---------
Using: OUI PRO 1.5.0.2 from http://www.dvorak.com

 
 
 

1. Please help me Sir !

Dear Sir
How are you i am doing well here hope you the same
from you.
How is life there ?.I am expecting some help from you
sir.
I have one local machine with postgresql and orion
,which is for development and another internet
connected machine with same postgresql and orion which
is serving my website.
Here in local machine and internet connected machine,
(which is serving my website) i have a database named
as mycompany.Now i will be entering data in local
database
in a particular table product.After that i have to
synchronize this local db with internet machine
db so that i will get both db with same data.
How i can do this please help me in this regard.
And please let me know how i can take backup for
particular table alone from a db and
how i can restore that data.
Expecting your reply.
Advance thankings for your reply.
Regards
waheed

__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command

2. Colllation change on already existing database (SQL 2000)

3. please acknowledge sir.

4. Why ENumAvailableMedia Failes????

5. Hello Sir

6. HELP - SQL 2K and ODBC 3.x problems

7. Hi Sir

8. Puzzle - HELP joining a table recursively++

9. HELLO SIR

10. More spam in your inbox, sir?

11. Ingres optimizer bug - not enough booleans (Access/ODBC) (SIR 42045)

12. S.I.R. (Scientific Information Retrieval)

13. Mailing List for SIR Database?