Question: Relating Screens in FoxPro Mac 2.5 
Author Message
 Question: Relating Screens in FoxPro Mac 2.5

I'm trying to build a relational database with custom screens, and ran
into a problem when building it. I have two questions.

1) How can I make a button on a screen that contains the "1" data in a
1-to-Many relation which will open another screen that will contain
only the records in the "many" table that are related to the currently
specified record in the "1" table.

2) How can I modify that "Add" button in a screen created by the Screen
Wizard so that it will automatically place today's date into a date
field, and so that it will automatically place the contents of a field
in the "1" table(not the related field in a relation by matching field)
into the newly added record in the "many" table.

Thanks.

BTW: As of yet, I do not have a mail server, so please post all replies
to the newsgroup. Thanks.

   --Adam



Wed, 01 Jan 1997 03:51:57 GMT
 Question: Relating Screens in FoxPro Mac 2.5


Quote:

> I'm trying to build a relational database with custom screens, and ran
> into a problem when building it. I have two questions.

> 1) How can I make a button on a screen that contains the "1" data in a
> 1-to-Many relation which will open another screen that will contain
> only the records in the "many" table that are related to the currently
> specified record in the "1" table.

This will depend on whether you are using a Foundation Read or not.  The
easiest way is to place a DO <yourScreen>.spr in the valid clause of the
button that you wish to cause the screen to be 'run' from.  The problem
here, is that if this is not a modal screen you can easily exceed FP's
5-read level limit.

If you are using a Foundation Read, then you likely have as part of your
READ VALID <yourHandler()> clause some mechanism to check for an event
triggering a new screen (something like a global variable--gToDo).  In
which case, in the Button's VALID clause you will set gToDo to
<yourScreen>.spr and then issue a ClEAR READ.  This will drop you down into
your Event Handler where you will notice that gToDo now contains the name
of the new screen to run.  Your handler then issues a DO (gToDo) and your
new screen hops up.

Quote:

> 2) How can I modify that "Add" button in a screen created by the Screen
> Wizard so that it will automatically place today's date into a date
> field, and so that it will automatically place the contents of a field
> in the "1" table(not the related field in a relation by matching field)
> into the newly added record in the "many" table.

Again, this depends <g>.  I can't recall if the screen wizard generates
code to do a direct edit (edits the table fields directly) or an indirect
edit (edits memory variables).  My suspicion is that it does a direct edit,
in which case you will go into the screen builder and add to the VALID
clause of the 'Add' button a line like REPLACE <variable1 name> WITH
DATE().  Likewise, to get the field from the "1" table into the new record
you would include in the VALID clause a line like REPLACE <variable2 name>
WITH <table1 name>.<table1 variable name>, i.e. REPLACE zip WITH
master.zip, where master is your "1" table, and zip is the variable name in
your "Many" table.

Hope that's clear <g>.

Steve.
--



Thu, 02 Jan 1997 00:41:39 GMT
 Question: Relating Screens in FoxPro Mac 2.5
Thanks for your help. As per your answer to question 1, I am to
understand that when I call the DO <screen> command that opens a screen
containing a relation to the currently open screen, only the related
data will be present in the opened screen? Also, in question 1, the
screen I am operating on is also one created by the Screen Wizard.

Concerning your answer to question 2, I wasn't clear as to the actual
nature of the problem. The main problem is that the "Add"  by the
screen wizard contains a VALID clause with an expression of
BTN_VAL('ADD'). If I change the expression to a procedure, the button
no longer functions.

Thanks for your help.

BTW: As of yet, I do not have e-mail access. Therefore please direct
all responses to this newsgroup. THanks.

  --Adam



Fri, 03 Jan 1997 05:29:46 GMT
 Question: Relating Screens in FoxPro Mac 2.5

Quote:

> Thanks for your help. As per your answer to question 1, I am to
> understand that when I call the DO <screen> command that opens a screen
> containing a relation to the currently open screen, only the related
> data will be present in the opened screen? Also, in question 1, the
> screen I am operating on is also one created by the Screen Wizard.

> Concerning your answer to question 2, I wasn't clear as to the actual
> nature of the problem. The main problem is that the "Add"  by the
> screen wizard contains a VALID clause with an expression of
> BTN_VAL('ADD'). If I change the expression to a procedure, the button
> no longer functions.

> Thanks for your help.

> BTW: As of yet, I do not have e-mail access. Therefore please direct
> all responses to this newsgroup. THanks.

>   --Adam

Adam
The screen wizard puts the code for the buttons it generates in a procedure
in the screen's cleanup area (either open all snipets, or open layout and
press the code button to find the cleanup area).  If you modify the code in
procedure btn_val that follows the case {somevarname} = "ADD"...
statements, you will change what the button does.  BTW, the wizard uses two
variables to influence how buttons should function. They are m.isediting
which is true if you are editing the variables that correspond to your
dabase records, and m.isadding if you are adding a new record.  if
m.isadding=.t., then m.isediting =.t.

 - Mike



Sun, 05 Jan 1997 05:48:33 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Newbie questions(2) for Foxpro 2.5 on Mac

2. FoxPro Mac FoxPro 2.5 & JetEngine

3. Foxpro for Mac 2.6 to Foxpro 2.5 for Windows

4. how to compress the screen in foxpro dos 2.5

5. Q: displaying multiple screens in FoxPro version 2.5

6. Multiple Screens with FoxPro 2.5

7. Screen Capture problems Running Foxpro 2.5 in a Windows NT 4.0 Environment

8. FoxPro DOS 2.5 screen stuck revisited

9. Transporter error for report, Foxpro Mac 2.5

10. FoxPro for Mac 2.5, Use command problem

11. FoxPro 2.5 MAC and App not Closing

12. Hotkeys in Mac FoxPro 2.5


 
Powered by phpBB® Forum Software