ReportView Item Color

Started by chrislegarth, May 03, 2022, 01:28:51 PM

Previous topic - Next topic

chrislegarth

I made a check in/out program that uses the ReportView control to display the days visitor list and the visitors current status of In/Out.
It is working beautifully but I'd like to make the cells in the Status column with an In status to be red.  I have used the @dcItemColor request before but only on small lists.
The visitor list can grow to several hundreds of visitors.  Refreshing the reportview data after a visitor checks in or out is quite responsive but the coloring is lost after the refresh.  When I loop through the array to color the "In" cells again it takes a second or two to complete after each update.

This is more of a sanity check to make sure I am not missing something or doing it all wrong.  Is there a way to color the cells before refreshing the reportview?  I don't think there is but I thought it best to ask the experts.

Thanks!

JTaylor

Is there an easy way to extract a list of the key fields for those needing to be colored?   Perhaps do that instead of looping through the entire list?   

Perhaps use TimerEvent and turn it on, on refresh, and color small groups until done and then turn Timer off?   Might be able to tweak that so it doesn't interfere with use and you could quickly color the initial items so it looks like what you want with initial view???

I think your coloring will be lost on refresh but will let the expert answer that definitively. 

Jim

td

How are you "refreshing" the "reportview data"? Are you reloading the entire control, a single column, or just changing the text of an individual cell in the column?
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

chrislegarth

I guess for lack of a better term I'm doing a rip and replace.  I drop the array, repopulate it from a SQL query, then replace the reportview control contents using @dcContents.

Jim- I did update my code to extract the "In" cells (good thought) when I populate the array and then just run through that list after I replace the reportview contents.  Though this is definitely more efficient codewise, I don't perceive any change in the coloring.

Tony- I am not familiar with updating a single column or an individual cell of the reportview.  Didn't know it could be done.  I'd appreciate any guidance or point me to the right help or example.

One thing I did not mention in the OP is the need to keep the sorting on the "Visitor" column, third column of the reportview, so visitors can find their name easily to check out.

Thanks!

JTaylor

Just to clarify...what do you mean you don't " perceive any change in the coloring"?   The cells you want colored are not?    If so, that part should work just like it did before, just without going through the entire list.   If not, you will need to provide more info.

Jim

td

If you clear the control and reload it, the color specification will be deleted. That is why is more efficient to change the content of a single cell. You only need to set the color for the cell you are changing. The content of an item cell can be changed using the @dcItemText request of the DialogControlSet function. However, you can not sort a column other than the first column without reloading the control. You might want to consider redesigning your control's column arrangement.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

chrislegarth

Jim- What I mean was that by only coloring the "In" cells and not touching the others and not looping through the whole array, I did not perceive any change in how the dialog responded.  The end result of the "In" cells being colored was correct.  I just did not notice an increase in coloring speed.  And it is obviously slower when everyone is checking in and does get faster as most people check out.

Tony- I did see the @dcItemText but my help says it was only valid with DialogControlGet and then only returns the first column text.  I'm currently using 2021D and reading the release notes for 2022B indicates the new functionality.

I appreciate everyone's insight and responses.  I now have some things to try which is what I was looking for.

Thanks!

td

If you have a current license you can download and install 2022B without charge; otherwise, you would need to buy a new license. It is a good idea to stay up to date version wise because you never know when you are going to need something that we have added or fixed.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Just so we are on the same page...you are updating the color directly and not searching for the item in the list, correct?  Although, what I think you are doing may be assuming a recent version.   What is a common ratio of ones needing colored to the entire list?   Also, when you say you are extracting the ones you need?   Are you pulling from a database or reading through your list and getting them that way?

Jim

Quote from: chrislegarth on May 04, 2022, 07:30:00 AM
Jim- What I mean was that by only coloring the "In" cells and not touching the others and not looping through the whole array, I did not perceive any change in how the dialog responded.  The end result of the "In" cells being colored was correct.  I just did not notice an increase in coloring speed.  And it is obviously slower when everyone is checking in and does get faster as most people check out.

Tony- I did see the @dcItemText but my help says it was only valid with DialogControlGet and then only returns the first column text.  I'm currently using 2021D and reading the release notes for 2022B indicates the new functionality.

I appreciate everyone's insight and responses.  I now have some things to try which is what I was looking for.

Thanks!

chrislegarth

Tony and Jim-  Thank you for your input.  Step 1 was to upgrade to 2022B so I could update the text in the reportview and such a recent addition :).  I was then able to recode the program to only have to replace and recolor the reportview control data every so often (and only when idle) as opposed to after every check in/check out.  I still have to replace the reportview control data from time to time because I have multiple check in stations available and need to sync to the database periodically.  My program is working much more smoothly thanks to your input.

Much Appreciated!

td

Thanks for letting us know you had some success speeding up your script. Reporting results help other users solve similar problems.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade