Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running reports from other working directories 1

Status
Not open for further replies.

harrymossman

Technical User
Sep 5, 2002
255
US
I am trying to build a launcher form that will work from whatever working directory a user is in. (Because I don't seem to be articulate enough to make users understand what a working directory is or how to change it.)

Sometimes this works, sometimes I get a message that the necessary table doesn't exist in the current working directory and do I want to use a different table.

Yesterday thought I fixed a lot of reports by saying choosing the right table, saving and changing the calculated fields, all of which, of course, said :work: to the correct alias. And saving. But today, they all say :work: again. (No one else would have messed with them since last night.)

Can someone give me some general instructions on how to do this kind of process?

Harry
 
Harry,

Hm. I think you'll need both types of aliases to make this work.

-- Table aliases, sometimes called monikers, will help with your calculated field problems. When you define a data model (place the tables on your report), right-click each table's "icon" in the data model, choose Table Alias, and type a name for the table in the data model. When you do this, Paradox uses this name (the table alias) for the report's objects. This removes the ":WORK:" reference and should save you effort in the long run.

-- Project Aliases are database aliases that are only defined for the current Paradox session. You can change where they point on the fly without having to save the results to BDE32.CFG.

The flip-side is that you need to make certain the proejct alias is defined before you try to work with files created using the alias. This means you can't design the report until you define the alias, nor can you run the report unless the project alias is defined. (I use scripts to maintain project aliases and run them each time an application starts.)

To define a proejct alias, use something along these lines:

Code:
	strWorkDir = workingDir()
	If strWorkDir.subStr( strWorkDir.size(), 1 ) = "\\" then
		strWorkDir = strWorkDir.subStr( 1, strWorkDir.size() - 1 )
	endIf

	addProjectAlias( "MAIN", "Standard", strWorkDir )
	addProjectAlias( "FORMS","Standard", strWorkDir + "\\FORMS" )
	addProjectAlias( "RPTS", "Standard", strWorkDir + "\\RPTS" )
	addProjectAlias( "LIBS", "Standard", strWorkDir + "\\LIBS" )
	addProjectAlias( "DATA", "Standard", strWorkDir + "\\DATA" )

Alternatively, you might create a Report Browser form that changes working directories on the fly. you'll need to add code to the form to keep it open as the working changes. See for examples.

Hope this helps...

-- Lance
 
Thanks. It doesn't seem practical to fix all the reports and forms that don't work from a single launcher. I might be able to get all the reports fixed but not all the forms. The idea of changing working directories seems better.

Harry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top