Sujit.
What about storing the data in another data file altogether that you can access from either. So…something like this… CREATE DATABASE IF NOT EXISTS DATAFILE <<$VerifyDataPath>> auto_close; USE LOCAL DATABASE datafile <<$VerifyStructurePath>> auto_close; CREATE TABLE IF NOT EXISTS VERIFY_INFORMATION(VERIFY_BLOB BLOB, VER_DATE DATE);..///etc USE DATABASE SQL_INTERNAL; then just store the path to the verify datafile in a the a Begin SQL USE LOCAL DATABASE DATAFILE <<$VerifyDataPath >> auto_close; SELECT VERIFY_BLOB FROM VERIFY_INFORMATION WHERE BIT_LENGTH(VERIFY_BLOB) > 0 INTO :$VER_BLOB, :$VersionData USE DATABASE SQL_INTERNAL; End SQL I do something like this in a different context(and not for using from two data files)..I use a blob for fields because i encrypt the data(with the keys hard coded) Nigel > On 19 Dec 2016, at 23:00, Sujit Shah <[email protected]> wrote: > > Thanks Nigel for your code. > > > In my situation I have a dialog which gives the user an option to choose > which data file they want to open: > > www.fortuna.com.au/4D_issues/startup-dialog.png > <http://www.fortuna.com.au/4D_issues/startup-dialog.png> > > So the user can either open/setup his/her file or explore a demo data file. > This was all cool till I put the object for days to expiry. This > information only comes from the Fortuna.4DD file and not from the > FortunaDemo.4DD file. I could have stored the activation date on some > hidden folder somewhere. But decided that it may be best to simply restart > the Application if it has been opened with the Live User data file. It is > kind of counter-intuitive as one would think how is the user ever going to > open the demo data file? > > For this I create a text file where I store the information of whether to > present this startup option or not. So that each time the application > launches it always opens with the Live Data and the startup option. If the > user selects to open the Live Data it just proceeds as normal. However if > the user chooses to open the demo data we set the text file so the startup > dialog is not presented and the application restarts with the demo data > file. > > This is working well for me now.. > > When I posted this, I thought it would be easier to know which data file > the application is going to open next read that information rather than try > to set the flag this way. > > > > > > > > > > > On Tue, Dec 20, 2016 at 1:20 AM, Nigel Greenlee <[email protected] > <mailto:[email protected]>> > wrote: > >> Sujit. >> >> >> >> You can control where the default datafile is using build with xml keys…i >> hope the following does not stray far from what you are trying to do…. >> >> >> >> I know that at one point I wanted to a make a downloadable single user >> demo version of a product AND i wanted new client server builds to guide >> the existing customers to open their correct current datafile. >> >> Realising that ‘virgin’ users confronted with ‘open datafile’ dialogues >> will wail in horror(and probably would end up creating a blank datafile) I >> did the following: >> >> 1) You will see in the code i get the ‘current data file’. I do this >> pretty much before anything else in my startup method-I don't know of any >> other way to interrogate it other than within the code-the method i use >> allows switching to another datafile on startup..(well not really on >> startup actually AFTER startup). >> >> In my startup method if the ‘wrong’ datafile is in use is don't do >> anything(i am a fan of doing as little as possible at startup anyway). >> >> While (Semaphore("$DuringLogin")) >> DelayTicks >> End while >> If (DB_ControlDataFilePath ) >> >> CLEAR SEMAPHORE("$DuringLogin”) >> //the correct datafile is in use carry on. >> else >> CLEAR SEMAPHORE("$DuringLogin") >> //don't do anything just let startup end-see what DB_ControlDataFilePath >> does to restart with the correct datafile. >> >> end if >> >> >> 2) Using a build key strategy i made sure there default datafile inside my >> package(not a good place to keep a datafile when someone overwrites the >> package). This was the demo datafile I wanted users to use. >> >> <?xml version="1.0" encoding="UTF-8" standalone="no" ?> >> <Preferences4D> >> >> <BuildApp> >> <BuildApplicationName>Database</BuildApplicationName> >> <BuildWinDestFolder/> >> <BuildMacDestFolder>::Database_Build:</BuildMacDestFolder> >> <DataFilePath>:DemoData.4DD</DataFilePath> >> >> Most of what i am doing here does not rely on the build with xml keys >> being used(that was really for doing a distributable structure to potential >> customers without having to go into complicated explanations about >> data-files) >> >> 3) On launch of the database I look for an invisible document that i >> create in the users document folder(Other strategies may be used for this >> of course-it would be better maybe if they were stored in for example >> 'Library/Application Support’ on a Mac). In the document i stored the path >> to the ‘real’ datafile. This meant that on first launch this document did >> not exist so it was created and the user was asked where they would like to >> store the data(offering them their document folder as a default). On that >> initial launch i then move the datafile store from inside the package to >> that location and store the path in the invisible document. >> >> 4) if the document exists then look to see if we are opening the last >> used datafile and if not switch it(in single user mode) or ask in client >> server mode. >> >> There are some nuances to the way you do this so I have posted a copy of >> the code i use on my drop box >> >> https://www.dropbox.com/s/j7vb6b6jgrfg5xq/DB_ControlDataFilePath.txt?dl=0 >> <https://www.dropbox.com/s/j7vb6b6jgrfg5xq/DB_ControlDataFilePath.txt?dl=0 >> <https://www.dropbox.com/s/j7vb6b6jgrfg5xq/DB_ControlDataFilePath.txt?dl=0> >>> >> >> Feel free to come back with any questions-the code is kind of self >> explanatory >> >> Nigel Greenlee >> >>> On 16 Dec 2016, at 02:03, Sujit Shah <[email protected]> wrote: >>> >>> Does anyone know where 4D Stores the default Data file an application >> opens >>> with? >>> >>> I know it opens the last Data file opened but where is this information >>> stored? >>> >>> -- >>> >>> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >>> "There must be ingenuity as well as intention, strategy as well as >>> strength. " >>> ********************************************************************** >>> 4D Internet Users Group (4D iNUG) >>> FAQ: http://lists.4d.com/faqnug.html >>> Archive: http://lists.4d.com/archives.html >>> Options: http://lists.4d.com/mailman/options/4d_tech >>> Unsub: mailto:[email protected] >>> ********************************************************************** >> >> ********************************************************************** >> 4D Internet Users Group (4D iNUG) >> FAQ: http://lists.4d.com/faqnug.html <http://lists.4d.com/faqnug.html> >> Archive: http://lists.4d.com/archives.html >> <http://lists.4d.com/archives.html> >> Options: http://lists.4d.com/mailman/options/4d_tech >> <http://lists.4d.com/mailman/options/4d_tech> >> Unsub: mailto:[email protected] >> <mailto:[email protected]> >> ********************************************************************** > > > > > -- > > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > "There must be ingenuity as well as intention, strategy as well as > strength. " > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html <http://lists.4d.com/faqnug.html> > Archive: http://lists.4d.com/archives.html > <http://lists.4d.com/archives.html> > Options: http://lists.4d.com/mailman/options/4d_tech > <http://lists.4d.com/mailman/options/4d_tech> > Unsub: mailto:[email protected] > <mailto:[email protected]> > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

