preventing paint of DbctrlGrid panel or deleting after fill

I am developing an application which queries a db for a file/exe path, among other things.  If the application exists, the grid should be populated.  If the application does not, I need to skip the resultset row or delete/hide the filled panel.  (ex. if quickbooks exist on a client machine, paint else move to the next rs row or delete the painted panel.

For the life of me, I can't work this out.  

I'm hoping someone here may have some suggestions.

*btw, I tried an alternative in iterating through the result set for the apppath; if the exe exists, proceed; else delete/filter the resultset row -no luck here either.....

Thanks in advance,

R Davis
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You could this :

1) Add a flag field into the table that stores the exe's path. Let's say APP_EXISTS type integer
    App Exists value = 1, App does not exist value = 0.
2) Write a procedure that updates the flag according to the existance of the file

3)Select from the database only the records that the application exists using the flag in the query
Select * from TABLENAME where APP_EXISTS = 1
and you will get only the records you want to display without trying to override the paint procedure of the grid.
brparrishAuthor Commented:
Yep, I thought about that, trouble is 100 people will use this daily, so modifying the DB isn't really an option.  I thought about an ADOtable on the form also, drop the dataset there, then read the results to appropriate fields.....that doesn't really seem viable either, but may be my only option.  -Thanks for your input
Well in my opinion you can implement this making a thread that will run to update the DB.
If you have to mofidy this table daily you could make a separate exe to run as a service
and make a scheduler to run on a spesific interval.

AdoTable is good but pretty slow try to do it using SQL and AdoTables this will speed up 100% the proccess specially if the DB Engine is MS SQL,MySQL generally a good DB engine.

If you could explain more the logic you want to implement maybe more ideas will appear.

CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

brparrishAuthor Commented:
Well, in a nutshell....we write a lot of software which is pushed out to our users.  Historically, we publish the shortcuts for these apps via GPO.  I'm trying to overcome that.  A db will host the name, appGroup, description and path of the exe.  Additionally, this app will also include apps like, IE, Outlook, Word, Excel etc....(in effort to clean the desktop).

So changing the DB isn't really a good option for me as up to 100 users will hit this app between 8:30 -9:00a.

What happens now (and this all works, w/exception of hiding local apps that aren't installed ex; Quickbooks).

query: select * from desktop_ui >> open dataset >> while not eof, fill panel fields w/the app name, description and group membership >> In an onpaintpanel event, take the exe path from the dataset; extract the icon or associated icon (if the object is a file, .pdf etc) and fill image1 w/it.

This all works great w/exception of the panels I'd like omitted/not-painted or skipped.

For example:  I've set an erroneous path for IE7  -however, db fields are populated -only image1 is skipped (because the icon can't be found)

I've tried checks such as fileexists()   -no dice.

For kicks, I've set silly behavior like changing the back color if the app is not found  -this works, so I know the if statement is good.  I just can't seem to find a way to remove or omit cells that don't apply to the respective user.

It is that dead end that got me focusing on a table to filter the rows prior to filling.

Hope this helps,

R Davis
Geert GOracle dbaCommented:
you have a form which is prepolutated with panels for all your apps ?

why not just change the visibilty of the panel ?

this is a little obscure as to what your form looks like
Geert GOracle dbaCommented:
the first time you load this thing, i agree it would take some time to find all the apps installed
why not save a TClientDataSet to a local file once processed
and then load from this local file the next time

you would use a thread to load all the possible apps from the db
and process which ones are available in this thread
within this thread you can then recreate the local file

opening the app the first time would be slow possibly
the second time, instant, and in the background it would be running the thread to check for new versions
brparrishAuthor Commented:
I actually received some help w/this via the delphi forums.....silly how simple is was:

procedure TForm1.rsFilterRecord(DataSet: TDataSet; var Accept: Boolean);
  Accept := FileExists(rs.FieldByName('AppExePath').AsString);

in the form create:

rs.Filtered := True;  -crazy!

Thanks to all for your input.

R Davis

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Geert GOracle dbaCommented:
it will still take a while to load your dataset
and will take a time to show your form as you do this in the formcreate
you may have to add a waiting cursor or even a form displaying it's busy
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.