[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: People Code



This solution comes to mind:
In your RowInit PeopleCode, code a SQLExec that checks every row to see if there
exists a row newer than the current row.  If no future row is found, perform the
update.  I think the syntax is roughly as follows:

sqlexec("select 'Y' from table t where t.key_field1 = :1, ... and t.effdt > :2",
key_field1, ... effdt, &FUTURE_ROW_EXISTS);

if &FUTURE_ROW_EXISTS = 'Y' then
   update_field = <update value>;
end-if;

Good luck


Cadenas, Maria (MT) wrote:

> Okay guys, I know this is not an SQR question, but if anyone knows
> PeopleCode, please help:
>
> Here are my lovely questions:
>
> 1) In People code, when you select  from a table and there is a 'Effective
> Date ' as field.  Will the query automatically pick the max effective date?
>
> 2)I have a panel then updates a field when the panel opens up. That is Ok
> but what it also does is change the data for that field in all the history
> panels. This results in incorrect data in all the history fields. How do you
> prevent a field from changing in the history records if the  Peoplecode
> indicates to update the field when loading the panel? Is there a way
> preventing this other than taking the code out of the 'Rowinit' ?