Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The datasets need to run in order #2

Closed
P-GRAFFIGNA opened this issue Apr 16, 2021 · 1 comment
Closed

The datasets need to run in order #2

P-GRAFFIGNA opened this issue Apr 16, 2021 · 1 comment

Comments

@P-GRAFFIGNA
Copy link

For the information be displayed in proper way, the datasets need to run in order, first the update then the restore and at last the Select.
As reporto builder doesn't have this functionality, I put the tree queries in one and in order

--FIRST RUNS THE UPDATE
UPDATE [dbo].[H_Targets]
SET [Target] = (CASE WHEN [Target] = 0 THEN 1 ELSE [Target] * @TGT_VAR END)
WHERE KPI = @kpi
AND @action = 'Update'

--SECONDS THE RESTORE
UPDATE [dbo].[H_Targets]
SET [Target] = [Target_Original_Values]
WHERE KPI = @kpi
AND @action = 'Restore'

--THEN THE SELECT STATEMENT
SELECT [KPI]
,[Target]
,[Target_Original_Values]
,[Grade]

FROM [dbo].[H_Targets]

@P-GRAFFIGNA
Copy link
Author

it works perfect !! THANKS JerBoom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant