Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Row always at the same position: is this possible?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Row always at the same position: is this possible?

 Post Reply Post Reply
Author
Message
MNovaro View Drop Down
Groupie
Groupie
Avatar

Joined: 20 June 2006
Status: Offline
Points: 71
Post Options Post Options   Thanks (0) Thanks(0)   Quote MNovaro Quote  Post ReplyReply Direct Link To This Post Topic: Row always at the same position: is this possible?
    Posted: 05 June 2007 at 2:58am
Hello, everybody

I would like to know if there is a way NOT to sort a particular row in a report control.
In particular: I have a report that has several rows, plus a row containing the total (sums) of all the values: I would like to keep this row a the last position even if other rows are sorted.

I can't use the footer, since I need "special" formatting for that row (bold font, red forecolor, etc.).

Any idea on how can I do this?
Thanks in advance.

Back to Top
LittleJK View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 April 2006
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote LittleJK Quote  Post ReplyReply Direct Link To This Post Posted: 05 June 2007 at 1:20pm
look into sort priority to do that
Back to Top
MNovaro View Drop Down
Groupie
Groupie
Avatar

Joined: 20 June 2006
Status: Offline
Points: 71
Post Options Post Options   Thanks (0) Thanks(0)   Quote MNovaro Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2007 at 9:01am

Thanks for your reply...
But, I tried to assign Item.SortPriority = 0 to the row that I don't want to move: this works, since all the items are sorted, excluding my row (that is, the row is not "mixed" anymore between the other rows)

But, if the items are sorted in descending order, my row is the first one, and not the last one (as I expect / want).
How can I manage this?

Thanks.
Marco
Back to Top
mlatona View Drop Down
Senior Member
Senior Member


Joined: 19 April 2005
Location: Germany
Status: Offline
Points: 124
Post Options Post Options   Thanks (0) Thanks(0)   Quote mlatona Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2007 at 4:49am
Hi,
 
I need this feature too. I will sort the rows but not the last row.
Is it possible for the next version?
Back to Top
MNovaro View Drop Down
Groupie
Groupie
Avatar

Joined: 20 June 2006
Status: Offline
Points: 71
Post Options Post Options   Thanks (0) Thanks(0)   Quote MNovaro Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2007 at 11:29am
Is there a workaround to implement this (even with some flickering)?? 
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2007 at 6:41pm
Originally posted by MNovaro MNovaro wrote:


But, I tried to assign Item.SortPriority = 0 to the row that I don't want to move: this works, since all the items are sorted, excluding my row (that is, the row is not "mixed" anymore between the other rows)

But, if the items are sorted in descending order, my row is the first one, and not the last one (as I expect / want).
 
That sounds like it its sorting.
 
A total row is going to be the highest value... making it the top row when sorted in descending order, the bottom row when sorted ascending...... I would think
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2007 at 6:43pm

Oh - and a simple way to do it would be to make it so when its sorted... its the bottom row.

 
Set the caption of the cell to what you want displayed.
 
When sorted descending ... give the row a value of something like -9999999 - when sorted ascending, give it a value of 99999999 (or whatever numbers are high enough, low enough)
 
That should accomplish what you want I would think.
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2007 at 3:13am

Just fyi... I originally ran across this while looking for something else... and now however many hours later... hum - ended up being a solution I needed as the Footer Row is to far away on tables with only 20 rows....
 
 
This is thrown together, junk code :) ... but its what I just used and it works perfectly.
 
I also do not have any fields/cells at the moment in this specific data set I am working with - so I am just guessing at the sort Alpha-Numeric sort order (Negative number to Z??)
 
Will play around with that, or if someone would know what would be the first sort character to the last sort character - that would help ... (like !@#$%&*())_=) where do they fit in? (and why the heck did this thing just autolink that??)
 
 
Data is the name I always use for ReportControls
 
TotalRecord is just a record that I gave its own name so I could reference it easily - and of course is what it says it is - the totals.
 
sa/tag of the TotalRecord Item is 0 for AlphaNumeric or 1 for Numeric
 
 
 
 
Insert this row last - and then it will be on the bottom - obviously - no need to worry about its value or anything as as soon as its sorted the first time - that will be taken care of.
 
 
 
 
 
Private Sub Data_SortOrderChanged()
    Dim tmp As ReportColumn
    Dim sa As Boolean
    Dim Item As ReportRecordItem
    For Each tmp In Data.SortOrder
        Set Item = TotalRecord(tmp.Index)
        sa = CBool(Item.Tag)
        If tmp.SortAscending Then
            If sa Then
                Item.Value = 1E+72
            Else
                Item.Value = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
            End If
        Else
            Item.Value = -1E+72
            'If sa Then
            'Item.Value = -1E+72
            'Else
            '
            'Item.Value = {low AlphaNumeric)
            '
            'End If
        End If
    Next

    Data.Populate
End Sub
 
 


**** I also tried the sortpriority method - seems straight forward - but did not work in the way I tried it.

It also seems like a much simplier method - if it would work in a way that it sorted something assigned a 0 always on top of something assigned a 1, on down the line - actually would be very cool - but it did not seem to do that (and it actually sctewed up all the sorting when I assigned it)


 

Back to Top
Godzilla View Drop Down
Newbie
Newbie
Avatar

Joined: 12 September 2007
Location: United Kingdom
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Godzilla Quote  Post ReplyReply Direct Link To This Post Posted: 12 September 2007 at 11:05am
Just been trying to do the same thing with totals in my report but without using the sort piority. I use a total line at the end of the report which is after a blank record. I have tried to do this by essentially assigning the value of each item of the total record to some var's and then deleting the old total row and finally readding the row at the end of the result list. I have tried doing this by adding the following code in the SortOrderChanged event:
 
iCount = data:records:count.
IF iCount <> 0 THEN
    DO i = (iCount - 1) TO 0 BY -1:
       IF data:records(i):tag= "total" OR data:Records(i):tag = "blank" THEN
          data:Records:RemoveAt(i).
     END.
iCount = data:records:COUNT
IF iCount <> 0 THEN
    DO:
       t-com1 = data:Records:INSERT(iCount).
         t-com1:Tag = "blank".
       iCount = iCount + 1.
       t-com2 = data:Records:INSERT(iCount).
       t-com2:Tag = "Total".
    END.
 
....... I then add all the items.
 

I have found that if there are six or less records in the report the above code works fine however when there are more than six records the Total line is place at the top and the blank line at the bottom.. Not sure why this is happening - any advise would be appreciated

 
 
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2007 at 5:14pm
Well, with recently released 11.2 -- it is better to use Footers rows collection for that...

--
WBR,
Serge
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.