Print Page | Close Window

Row always at the same position: is this possible?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=7302
Printed Date: 20 September 2024 at 3:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Row always at the same position: is this possible?
Posted By: MNovaro
Subject: Row always at the same position: is this possible?
Date 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.




Replies:
Posted By: LittleJK
Date Posted: 05 June 2007 at 1:20pm
look into sort priority to do that


Posted By: MNovaro
Date 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


Posted By: mlatona
Date 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?


Posted By: MNovaro
Date Posted: 13 June 2007 at 11:29am
Is there a workaround to implement this (even with some flickering)?? 


Posted By: Zach
Date 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


Posted By: Zach
Date 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.


Posted By: Zach
Date 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 mailto:!@#$% - !@#$% &*())_=) 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)


 



Posted By: Godzilla
Date 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

 
 


Posted By: sserge
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net