Jump to content
Salesforce and other SMB Solutions are coming soon. ×

GTRR or Create New


spongersgirl
 Share

Recommended Posts

I've looked at a couple similar posts, but still can't get it to work. Here's what I want to do:

 

Have job record (on job layout with job id). Want to create a button that:

 

Searches for and opens a Related Record (an invoice - looking to see that the job ids match).

 

AND if there is no related invoice, create a new one.

 

I can get it to go to related record. I can get it to create a new record... but I can't figure out how to make it open the related record if there is one and create a new record if there isn't one. argh. :P

 

I'm still pretty new to FMPro8, so if you start using global fields and stuf, please be patient and explain it well. :)

Thanks!

Amanda Y

Link to comment
Share on other sites

In the parent table, test for the existence of a related record. If one exists use your GTRR, otherwise use your Add Invoice script:

 

If [ relationship::recordID ]

Go to Related Records [ Show ; relationship ]

Else

Perform Script [ Add Invoice ]

End If

Link to comment
Share on other sites

So here's what I tried... and it didn't work.

 

On tour page (the starting point) I have a button to go to invoice,etc.

Script:

If [tours::tourid]

Go to related record [show only related records; from table: "invoices"; Using layout: "invoices"; new window

Adjust window (maximize)

Else

Perform script ["create new invoice"; parameter: "tours::tourid"

End if

 

Create new invoice script:

set variable [$$guestid; value:tours::guestid

new window

go to layout ["invoices"(Invoices)]

new record/request

set field [invoices::tourid; get (scriptparameter)]

set field [invoices::guestid; $$guestid

 

The create new invoice script works fine on its own... and go to related records seems to be okay... but when I try to do the if, else thing... nothing happens on records with invoices and records without them... I'm confused.

 

Any help would be MUCH appreciated!

Thanks,

Amanda

Link to comment
Share on other sites

That did something, but now every record, even ones with invoices, create new invoices... it doesn't stop if it finds a related record...

:)

Link to comment
Share on other sites

I tried changing the If [invoices:invoiceid] to If [invoices::tourid]... but I still have the same problem...

Link to comment
Share on other sites

Hi.

 

from the your original post:

Searches for and opens a Related Record (an invoice - looking to see that the job ids match).

 

what is the name of the relationship that you use for jobs-invoices? use that name in the IF statement and the GTRR. Then Ender's solution should work fine. Assuming it's always one job-one invoice.

 

maarten

Link to comment
Share on other sites

Awesome! I went back and checked my relationship. I realized that the relationship was based on invoiceid... which for some reason I can't get to pull in to my job layout... so since there was no invoice id on the job layout... there was nothing to referrence from. I changed the relationship to be based on the tourid, and it seems to be working now!

 

Thanks everyone! :) Now if I can just get the invioce id to port itself into the job layout. :)

You guys rock!

Amanda

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use