04-24-2007 10:55 PM
Hi,
I have the following known values on the left hand side
1----
(1)
10----
(5)
10.5-------(6)
1.5----
(2)
2----
(3)
2.5----
(4)
and would want to give a number in parentheses to the corresponding number on the left hand side, so when sorting the number in parentheses the number will be sorted in the following order:
1----
(1)
1.5----
(2)
2----
(3)
2.5----
(4)
10----
(5)
10.5----
(6)
How would I write a logic to assign the numbers in paraentheses to the number on the left hand side?
Thanks
04-25-2007 12:07 AM
this field should be type P and give decimals as per your requirement then it will work.
Reward points if it is useful.
Phanindra
04-24-2007 11:06 PM
concatenate '(' lv_number ')' into lv_paranthesis.
increment the lv_number for every record.
Reward the points if useful.
04-24-2007 11:20 PM
Each number in the parentheses does not necessarily have to be in parentheses per your suggestion; it is just an example to explain my approach.
Maybe I shoud rephrase the question:
I have the following know numbers
1
10
10.5
1.5
2
2.5
and would want to sort them in the following order. How would I write a logic to get the sorted results?:
1
1.5
2
2.5
10
10.5
Thanks
04-24-2007 11:31 PM
if that field type is character it will sort automatically. what is the field type.
04-24-2007 11:39 PM
first sort tne table by ascending order and
loop through each record incrementing the counter and concatenate the braces to it for the second field
i hope this should help you .
Cheers
Srinu reddy.
04-24-2007 11:45 PM
It is a type CHAR and I want to sort it to be of type number in sequence 1, 1.5, 2, 2.5...10 and not of tyoe CHAR in the following order
1
10
10.5
1.5
2
2.5
Thanks
04-25-2007 12:07 AM
this field should be type P and give decimals as per your requirement then it will work.
Reward points if it is useful.
Phanindra
04-25-2007 1:00 AM
That's the main purpose of this question. The type must be CHAR, and the values are numbers. So I trying to find a way to somehow give the sequence of indexes for these numbers and sort by the index. I am trying to see if anyone has done this and can give me some pseudo code. This was explained originally when I posted the question.
I have a table of these value numbers but the field is type CHAR. When I sort the column field, it will sort according to type CHAR, but I want to see the numeric sort for this column. I was thinking that I would add another field to this table and give the column field the type P, but how would I write a program to determine what index of type P to assign to the field column of type CHAR. Each field of type CHAR will have the index value of type P, and I would sort using the index field and not the field type CHAR.
Thanks
04-25-2007 1:09 AM
Hi,
As you said, have an another column with type P..
Then when you move the values to the character field move the same value to the type P field also..
When you sort ...sort by the type P column..
Thanks,
Naren