If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Corel Paradox > Passing parameter into form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 12:47
alberon alberon is offline
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 4
Passing parameter into form

Hi,

I'm working with two forms, quotes and reviews. I'd like to be able to open the review form from the quotes form and view the related record (one or no reviews per quote).

So I'd like to open the review form and pass in the review no (which is a field in the quotes table). When the form opens, I'd like to scroll to the related record (ie the record whose primary key = the parameter value.)

Could someone please explain how to do this in ObjectPal, or by some other method. I'm using paradox 9.

cheers

Tim
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 14:34
lmckelvy lmckelvy is offline
Registered User
 
Join Date: Oct 2003
Posts: 107
You can do this a couple of ways, using a query OR a simple number pass. Here's some ideas to get you going.

Query

1) Run a quick query against the Review Table you plan to see with the Review Form.

2) Create the Review Form, but base it on ANSWER.DB instead of the table.

3) Stick a button on the Quote Form and add code to:

4) Query the Review Table using a tilde variable that you assign with the value of Review No.; then

5) Open the Review Form and call wait().

6) The query should have produced only one record, so that's what you see. If you also have a report based on ANSWER.DB then you can fire that one record off to the printer.


Number Pass

1) Put a button on the Quote Form.

2) In the button code, assign the current Review No. to an evironment variable (see the example in writeEnvironmentString()); then,

3) Open the Review Form and stick some code in the arrive method of the MRO or Tableframe based on the environment variable. The code can consist of a setRange() operation or a tCursor.locate().

Anyway, if you need help with the coding let me know.

Mac
Reply With Quote
  #3 (permalink)  
Old 11-05-03, 14:51
alberon alberon is offline
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 4
Many thanks for your help. I think I'll try the second method. So I take it there's no way to pass a parameter in the way I was thinking of ......
Reply With Quote
  #4 (permalink)  
Old 11-05-03, 15:14
lmckelvy lmckelvy is offline
Registered User
 
Join Date: Oct 2003
Posts: 107
Not directly, although coming back from a form you can return values (see formReturn) - even arrays.

Mac
Reply With Quote
  #5 (permalink)  
Old 11-05-03, 17:24
lmckelvy lmckelvy is offline
Registered User
 
Join Date: Oct 2003
Posts: 107
I wanted to add something of my private response to alberon in case anyone else was interested. Assume Two Forms, Quotes.FSL and Reviews.FSL and two tables with the same names, tied to each of their namesakes.

This code is in the pushbutton method of a button on the Quotes.fsl form:

Code:
method pushButton(var eventInfo Event)
var
	revForm	form
endvar

;make sure there is a value in the reviewNum field
if ReviewNum.value = ""
	then	msgStop("Error","No Review Number!")
   		return
endif

;load an environment variable with the data
writeEnvironmentString("RevLoad",ReviewNum.value)

;open the review form and wait.
revForm.open(":work:Reviews.fsl")
revForm.wait()

endMethod

AND this code is in the Open method of the Reviews MRO on Reviews.FSL:


Code:
method open(var eventInfo Event)
var
	RevPassNum	longint
endvar

RevPassNum = longint(readEnvironmentString("RevLoad"))

;use this to make it where they cannont scroll to other records
Reviews.setRange(RevPassNum,RevPassNum)


;OR this to do a simple locate that allows them to see other reviews

;if not Reviews.locate("ReviewNum",RevPassNum)
;	then errorShow()
;endif

;Reviews.forceRefresh()


;the Reviews MRO is not visible at run time. This brings it up.
;sometime this helps with screen flicker.
Reviews.visible = True

endMethod
As you can see there are two possible methods to display the correct review shown in the second code example. They cannot be used at the same time (hence the comment marks).

The only other thing to note is that when using setRange() the table must be indexed.

Hope this helps,

Mac

Last edited by lmckelvy; 11-05-03 at 17:53.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On