MauditOstie
Member
Hi everyone, i recently changed from CHUI to GUI and well,
i'm having a hard time loading my queries properly.
Thing is, there are 2 tables linked.
Employer and Emplr-Status.
Here is what i would like it to do, in simple CHUI code:
All i want in my browser are emplr-status.status-code = 5.
I cannot find a way to create a query that will work
Example:
Employer No: 123456
Emplr-status records:
Seq Emplr No Effective Date Status
-------------------------------------------------------------
1 123456 01/01/2010 1
2 123456 02/02/2010 2
3 123456 04/05/2010 6
4 123456 04/05/2010 5
5 123456 04/05/2010 2
6 123456 12/12/2010 5
The CHUI code will position us on Seq #5 of the status...
But all i was able to do right now is positioning my query on Seq #4 so it wrongly shows in my broswer...
Anyone got an idea? Here is an example that i tried and that failed. I also tried it with a buffer on my emplr-status table to check the rowid's. I'm really running out of ideas.
EXAMPLE 1:
i'm having a hard time loading my queries properly.
Thing is, there are 2 tables linked.
Employer and Emplr-Status.
Here is what i would like it to do, in simple CHUI code:
Code:
FOR EACH employer NO-LOCK:
FIND LAST emplr-status where emplr-status.emplr-code = Employer.emplr-code AND
emplr-Status.effective-date <= TODAY No-lock No-error.
IF emplr-status.status-code = 5 THEN
DISPLAY emplr-status.
END.
All i want in my browser are emplr-status.status-code = 5.
I cannot find a way to create a query that will work

Example:
Employer No: 123456
Emplr-status records:
Seq Emplr No Effective Date Status
-------------------------------------------------------------
1 123456 01/01/2010 1
2 123456 02/02/2010 2
3 123456 04/05/2010 6
4 123456 04/05/2010 5
5 123456 04/05/2010 2
6 123456 12/12/2010 5
The CHUI code will position us on Seq #5 of the status...
But all i was able to do right now is positioning my query on Seq #4 so it wrongly shows in my broswer...
Anyone got an idea? Here is an example that i tried and that failed. I also tried it with a buffer on my emplr-status table to check the rowid's. I'm really running out of ideas.
EXAMPLE 1:
Code:
&Scoped-define QUERY-STRING-br_table FOR EACH employer WHERE ~{&KEY-PHRASE} NO-LOCK, ~
LAST emplr-status WHERE emplr-status.emplr-code = employer.emplr-code ~
AND emplr-status.effective-date LE TODAY AND ~
(IF emplr-status.status-code EQ 5 THEN TRUE ELSE FALSE) NO-LOCK ~
{&SORTBY-PHRASE} INDEXED-REPOSITION
&Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH employer WHERE ~
{&KEY-HRASE} NO-LOCK, ~
LAST emplr-status WHERE emplr-status.emplr-code = employer.emplr-code ~
AND emplr-status.effective-date LE TODAY AND ~
(IF emplr-status.status-code EQ 5 THEN TRUE ELSE FALSE) NO-LOCK ~
{&SORTBY-PHRASE} INDEXED-REPOSITION.