Showing posts with label manipulation. Show all posts
Showing posts with label manipulation. Show all posts

Monday, March 12, 2012

manipulation with numbers in SQL

Hi folks,

I am trying to divide a number by another number.. for example,

'-5037542 / 143149696'

The answer should be -0.03519.

Inspite of using round,convert and numeric functions i am unable to get the answer as above. It calculates wrongly..

I would appreciate if anyone could help.

TIA,
Nishaint / int = int, convert either number to a float and you will get your answer
select -5037542 / cast(143149696 as float) as 'Ans'

Ans
----------------
-0.0351907278936869|||Thanks a lot Paul Young!!!

-Nisha

Manipulation in the front end

Hi

I have a scenario while creating a report where I need to maintain the same number of rows for a column, even if the data grows or shrinks for that column

example

Each Scenario is grouped by ID

Scenario 1

columnA

Row1 X X

Row2 X

Row3 X

Row4 XYZ

Scenario 2

columnA

Row1 XA

Row2 XYZ

In both scenario's I need to control from front end

the number of row should remain 4

I am grouping by row field say Type

This field Type varies for each ID group

This seems to work.

1. Use a table with a group on the ID field.

2. Use four rows in the detail section

3. On the first detail row Hidden property use this expression.

=iif(RowNumber("table1_Group1")<=4,False,True)

4. On the second detail row Hidden property use this expression.

=iif(CountRows()=1,False,True)

5. On the third detail row Hidden property use this expression.

=iif(CountRows()=1 or (CountRows()=2 and RowNumber("table1_Group1")=2) ,False,True)

6. On the third detail row Hidden property use this expression.

=iif(CountRows()=1 or (Countrows()=2 and and RowNumber("table1_Group1")=2) or (Countrows()=3 and and RowNumber("table1_Group1")=3) ,False,True)