Hi everybody
I have in a table differents field and ID_GROUPE_LOT, ID_DATE_DEBUT_VALIDITE (Julien format).
ID_DATE_FIN_VALIDITE (Julien format) = -1
I want to update ID_DATE_FIN_VALIDITE (Julien format) with the previous value of ID_DATE_DEBUT_VALIDITE - 1 day if it's the same ID_GROUPE_LOT. The bigger value of ID_DATE_DEBUT_VALIDITE must not be update
For that, I have a select with ID_GROUPE_LOT order ASC, ID_DATE_DEBUT_VALIDITE order DESC.
In my transformer, I use that :
If RowProcCompareWithPreviousValue ( L_LectODS_SUIVI_ETAT_LOCATIF.ID_GROUPE_LOT) Then RowProcGetPreviousValue( L_LectODS_SUIVI_ETAT_LOCATIF.ID_DATE_DEBUT_VALIDITE)-1 Else -1
But the value returned is ID_GROUPE_LOT - 1 .
Explain me how do that ?
Thaks for your help
Frederic from Paris in France
RowProcGetPreviousValue and RowProcCompareWithPreviousValue
Moderators: chulett, rschirm, roy
Hi,
In general the routines mentioned for attaining/comparing the current and previous valuse use the basic's common space to save the last row's value and compare it with the current row's value.
The only thing the compare routine does is return @TRUE (or 1) if the value you have is the same you had in the previous one otherwise @FALS (or 0) is returned.
So you simply used an improper routine for what you need to perform.
How many values you can get of the date?
are there only 2 values?
If more then 2 values do you need a specific one?
all this will effect the solution you need!
IHTH,
In general the routines mentioned for attaining/comparing the current and previous valuse use the basic's common space to save the last row's value and compare it with the current row's value.
The only thing the compare routine does is return @TRUE (or 1) if the value you have is the same you had in the previous one otherwise @FALS (or 0) is returned.
So you simply used an improper routine for what you need to perform.
How many values you can get of the date?
are there only 2 values?
If more then 2 values do you need a specific one?
all this will effect the solution you need!
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Like I explain, I must put the previous value ID_DATE_DEBUT_VALIDITE - 1 day for the same ID_GROUPE_LOT in ID_DATE_FIN_VALIDITE for give that :
id_groupe_lot........id_date_debut_validite........id_date_debut_validite
---------------........--------------------------........--------------------------
9.........................2453250.............................-1
9.........................2452154.............................2453249
9.........................2450669.............................2452153
12.......................2453158.............................-1
12.......................2451088.............................2453157
17.......................2453038.............................-1
17.......................2453020.............................2453037
18.......................2452349.............................-1
18.......................2451657.............................2452348
18.......................2449839.............................2451656
...
So I have many values of date.
Have you a idea. I'm a datstage basic user.
Thank you for your help
Frederic
id_groupe_lot........id_date_debut_validite........id_date_debut_validite
---------------........--------------------------........--------------------------
9.........................2453250.............................-1
9.........................2452154.............................2453249
9.........................2450669.............................2452153
12.......................2453158.............................-1
12.......................2451088.............................2453157
17.......................2453038.............................-1
17.......................2453020.............................2453037
18.......................2452349.............................-1
18.......................2451657.............................2452348
18.......................2449839.............................2451656
...
So I have many values of date.
Have you a idea. I'm a datstage basic user.
Thank you for your help
Frederic
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Maybe if you want to retain the max value, then your logic must be changed to
[/i]
Code: Select all
If
RowProcCompareWithPreviousValue ( L_LectODS_SUIVI_ETAT_LOCATIF.ID_GROUPE_LOT) Then
RowProcGetPreviousValue( L_LectODS_SUIVI_ETAT_LOCATIF.ID_DATE_DEBUT_VALIDITE)-1
Else
L_LectODS_SUIVI_ETAT_LOCATIF.ID_DATE_DEBUT_VALIDITE
If you want to perform this in 2 jobs, this is my suggesstion.
First job, based on the key do an update with date -1 and second job do an insert with the current values. While doing update, you should update the latest (previous value than current). I have no idea how you are maintaining this in your project.
HTWH.
Regards
Saravanan
First job, based on the key do an update with date -1 and second job do an insert with the current values. While doing update, you should update the latest (previous value than current). I have no idea how you are maintaining this in your project.
HTWH.
Regards
Saravanan
Hi,
Your example sugests the data is sorted in ascending order so in this case
You can manage the functionality using stage variables.
since they are computed sequentially use the last stage variable to hold the current value, this way when you compute stage variables that apear before the last one you can access it's value hence get the previous rows value.
IHTH,
Your example sugests the data is sorted in ascending order so in this case
You can manage the functionality using stage variables.
since they are computed sequentially use the last stage variable to hold the current value, this way when you compute stage variables that apear before the last one you can access it's value hence get the previous rows value.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Hi everybody
We cannot use 2 different RowProcPreviousValue inb the same. The only solution is to make that with 2 jobs. So I found a solution.
The first job update the ID_DATE_FIN_VALIDITE by the previous ID_DATE_DEBUT_VALIDITE
The second job update ID_DATE_FIN_VALIDITE = -1 if the previous ID_GROUPE_LOT is different.
This method match.
Thank you all for your help.
We cannot use 2 different RowProcPreviousValue inb the same. The only solution is to make that with 2 jobs. So I found a solution.
The first job update the ID_DATE_FIN_VALIDITE by the previous ID_DATE_DEBUT_VALIDITE
The second job update ID_DATE_FIN_VALIDITE = -1 if the previous ID_GROUPE_LOT is different.
This method match.
Thank you all for your help.