Sql macro plugin

Ravi June 11, 2012

Hello all

We are trying to manipulate table data using math operation. As part of populating the report we are using sql macro to capture the data as follows

{sql:datasource=TestRO|table=false}
DECLARE @kloc_total float
DECLARE @var1 float
select @kloc_total = total from ##kloc
select @kloc_total/1000{sql}

We want to capture the above result to a varible and use the variable in java script further manipulate the result before rendering back to the page.

Manipulation we are trying to make is doing some math on the result in the form of multiplication.

Can anybody point me in the right direction how this can achieved.

Thanks

Ravi.

2 answers

0 votes
Ravi June 14, 2012

Thanks Bob

Based on your other comments on different issues i have used replace-and-render macro to get this working.

Thanks

Ravi.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2012

Generally speaking it is best to just let your SQL query do the math for you and if necessary, add some sql functions to your database to make it easier. A simple example would be:

select sum(kloc)/1000 from klocTable

You can also use a groovy or other script to manipulate the results (How to generate choice values using SQL shows some techniques in this area), but normally not needed if you have someone with sql skills.

Suggest an answer

Log in or Sign up to answer