on 05-24-2006 6:41 PM
Does anyone know how to create an approval procedure that is triggered by a row field. For example if I want an approval procedure that verifies discount percentage in row level.
There must be a workaround, cause I know this is not a functionality in SBO.
Thanks,
Hernán Baudrit
The way you could solve this is to create a UDF at Header level and link a formatted search which loops through the number of rows in the transaction and returns TRUE if for example the Discount % is greater than allowed.
The coding should be something as follows:
-
Declare @Counter as integer
Set @Couter = 0
Declare @TempTable TABLE (STAT varchar(50)) -- Temporary table holding results of loop
Declare @LoopFor as integer
Set @LoopFor = (select (*) from (select T1.DocEntry
from INV1 T0 join OINV T1 on T0.DocEntry = T1.DocEntry
where T0.DocNum = $[OINV.DocNum])
)
While @Counter < @LoopFor
BEGIN
Declare @Disc as integer
Set @Disc = ( select T1.DiscPrcnt
from INV1 T0 join OINV T1 on T0.DocEntry = T1.DocEntry
where T0.DocNum = $[OINV.DocNum]) and T1.LineNum = @Counter
)
IF @Disc > 20
BEGIN
INSERT @TempTable VALUES ('TRUE')
END ELSE INSERT @TempTable VALUES ('FALSE')
@Counter = @Counter + 1
END
SELECT Distinct 'TRUE' from @TempTable where STAT = 'TRUE'
-
Please note that the coding is not 100% accurate but should give you an idea of how to work around the problem.
Next you should write a simple validation query on the value of the UDF to check whether it is set to 'True'.
I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In a project I have worked on, we created a header field containing a boolean; whenever one of the rows triggered the approval condition, the add-on set that header field to true right before saving, otherwise it reset it to false (or something to that extent).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> In a project I have worked on, we created a header
> field containing a boolean; whenever one of the rows
> triggered the approval condition, the add-on set that
> header field to true right before saving, otherwise
> it reset it to false (or something to that extent).
Hi there Massimiliano
Thank you for your prompt response, the issue that we are experiencing is that the query only reads the first line of the Order for approval and cannot follow through the following lines. Hence if the order has a first line that requires approval it generates the approval procedure but if the approval is in the second or subsequent line which requires the approval because the first line was false it skips the approval procedure.
Regards
Ernest A Dumont
Hi Ernest; Massimiliano;
It seems it has been fixed on version 2005A SP01. You can create an approval procedure based on line data, and no matter if it is not the first line. Try:
SELECT 'TRUE' FROM OITW T0 WHERE T0.ItemCode = $[38.1.0] AND T0.WhsCode = $[38.24.0] AND T0.OnHand < $[38.11.NUMBER]
Does anyone know how to create an approval procedure
that is triggered by a row field. For example if I
want an approval procedure that verifies discount
percentage in row level.
There must be a workaround, cause I know this is not
a functionality in SBO.
Thanks,
Hernán Baudrit
Hi there Hernan
Did you manage to solve this issue as we are experiencing a similar request from a client and are experiencing difficulties.
Regards
Ernest A Dumont
NGO Consulting
ernest@ngo.co.za
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
9 | |
9 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.