Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 4:03 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Database Path Change
PostPosted: March 12th, 2009, 5:29 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi,

I am currently trying to allow the user to be able to change the path of a database used in my publication.

I have the database set up and connecting before user attempts to change location. Then I used a variable in the "Path for File when Published" in the Database Tab publication Properties.

Through script I allowed the user to save their own path to a text file that will be opened in script the moment the publication is launched. This sets the path location variable to the users new location, see code:

Code:
function DatabasePathCheck()
{
   Debug.trace("DatabasePathCheck " + "\n")
   if(FileExists(SYSTEM_PUBLICATION_DIR + "DatabasePath.txt"))
   {
   var textPathDB = OpenFile(SYSTEM_PUBLICATION_DIR + "DatabasePath.txt")
   var tempPath = textPathDB.ReadLine();

   if (tempPath.length > 2)
   {
   Debug.trace("String Length > 2 - Check File Exists" + "\n")

         if(FileExists(tempPath))
         {
         Debug.trace("DB Exists: " + tempPath + "\n")
         Database_Path = tempPath;
         //SETS NEW DATABASE LOCATION
         }

         else
         {
         Debug.trace("DB NOT Exists" + "\n")
         //DB DOES NOT EXISTS
         }
   }

   else
   {
   Debug.trace("String Length < 2 " + "\n")
   Debug.trace("Assume Invalid Directory" + "\n")
   }
}
}



This script doesn't work, as it looks like it is not possible to dynamically change the database location. Am I trying to do something that is not possible?

Have been playing around with this, is the path for the database hardcoded into the Opus publication once launched?


Thanks

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


Last edited by lmc on March 12th, 2009, 10:25 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: March 12th, 2009, 9:34 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
No it's not hard coded. It's pulled from the setting in the db tab when a connection is made.

It may be possible to even change the location after the db has been accessed if the db has been closed - but I've never had a need to try this theory.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 12th, 2009, 10:03 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Yeah, I've tried to change it after connection is closed and before the connection it opened. But changing the variable in the db tab does not work.

Thanks for reply.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


Top
 Profile  
 
 Post subject:
PostPosted: March 12th, 2009, 11:41 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
It works!

As usual I made a silly mistake. I was including the full path and file name in the txt file. But you only require the path. It now works, Excellent.

I also removed the check if file exists in the code and added a If db connects statement to see if it works, if not then revert to default database location.


Sorry for all the questions.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group