delete data source, or test for its existence -- possible?

Hello,

My script creates a data source for a table view every time it runs.
I would prefer it to test for the existence of the data source before creating another one.
Or else, it could delete the data source before ending a run.
How do I achieve that?

Thank you for help!
LG

How do you store the data source?

Hello, Adam,

the general structure is like this:


global theDataSource

on theMainHandler
-- ...
   if exists theDataSource then delete theDataSource -- so it is not created anew every time theMainHandler is called
--  => "the variable theDataSource is not defined"
   get my subHandler
   -- ...
   display dialog count data sources -- hunting the memory hog
end theMainHandler

on subHandler:
   -- ...
   set theDataSource to make new data source at end of data sources with properties {name:"theDataSource"}
   set the data source of table view "TView" of scroll view "SView" of window "Win" to theDataSource
   -- ...
end subHandler

Greetings,
LG