Creating New Record in a Portal; Multiple Portals

  • Follow


I know you can create a new record in a Portal (actually in the related file) 
by clicking on the next blank row and entering the corresponding data. 
However, I can't figure out how to do this within a script. "Go to last row, 
Go to next row", for example, doesn't work. Hope I'm missing something 
obvious :-)

Of course, I can add a script in the related file to make a new record and 
execute it from the original file, but the relationship field doesn't get 
automatically filled like it does if I create it from within the portal, so I 
have to define globals, etc. to make that work. Not very convenient.

Also, a related question: if you have multiple portals on a layout, how do 
you tell a script which one you are referring to in any given step?

Thanks,

Steve

0
Reply Steve 8/5/2003 10:46:37 AM

Hi Steve,

> I know you can create a new record in a Portal (actually in the related
file)
> by clicking on the next blank row and entering the corresponding data.
> However, I can't figure out how to do this within a script. "Go to last
row,
> Go to next row", for example, doesn't work. Hope I'm missing something
> obvious :-)

You can use "Set Field" in stead, specifying the field from the related
file. This creates a new record in the related file and auto-enters the
relationship field.

> Also, a related question: if you have multiple portals on a layout, how do
> you tell a script which one you are referring to in any given step?

I have stumbled upon this problem recently as well and I haven't been able
to solve it, other than making multiple layouts which only have the portal
that is needed by the script at that time.

Regards,

Peter


0
Reply Peter 8/5/2003 11:25:00 AM


> You can use "Set Field" in stead, specifying the field from the related
> file. This creates a new record in the related file and auto-enters the
> relationship field.

I forgot to mention that this only works if your portal does not yet contain
any records. If it does, you should insert "Go to portal row [last]" before
Set Field.

Peter


0
Reply Peter 8/5/2003 11:36:34 AM

in article 0001HW.BB55034D000EB44F09DFB670@text.giganews.com, Steve at
nospam@nospam.com wrote on 5/8/03 8:46 PM:

> Of course, I can add a script in the related file to make a new record and
> execute it from the original file, but the relationship field doesn't get
> automatically filled like it does if I create it from within the portal, so I
> have to define globals, etc. to make that work. Not very convenient.

Not as easy to setup up, granted, but nevertheless an acceptable alternative
for creating new related records.  It has the following advantages:
* it  can be used even when the relationship does not allow the creation of
new records through the portal
* it allows tighter control, such as checking that other conditions have
been met, or performing other actions at the same time
* new "blank" records can be made to appear at the top of the portal,
instead of at the bottom (useful if there are more related record than the
portal can display in its window and/or if the related records are sorted in
descending chronological order)

Don't write it off, even if it doesn't suite your present purposes.

Bridget Eley

0
Reply Bridget 8/5/2003 10:07:04 PM

another alternative is to create a unique relationship for creating the
individual record,  Create a key similar to the existing portal target , but
make it a calc that incorporates a date stamp (using Status(current...)
function, and written to convert the date  to text). A global counter is also be
incorporated (which can be reset to 1 at startup...).  Include a  script line to
also set the existing (portal) key field to the necessary value. A time stamp
could be included too. An example from one of my soutions :


key_NewPurchase =
ING_ID & " "  & g_Source &" "  & DateToText(g_Purchdate)  & " " & _counter new


Chris Brown
Neurosurgery
University of Adelaide




Steve wrote:

> I know you can create a new record in a Portal (actually in the related file)
> by clicking on the next blank row and entering the corresponding data.
> However, I can't figure out how to do this within a script. "Go to last row,
> Go to next row", for example, doesn't work. Hope I'm missing something
> obvious :-)
>
> Of course, I can add a script in the related file to make a new record and
> execute it from the original file, but the relationship field doesn't get
> automatically filled like it does if I create it from within the portal, so I
> have to define globals, etc. to make that work. Not very convenient.
>
> Also, a related question: if you have multiple portals on a layout, how do
> you tell a script which one you are referring to in any given step?
>
> Thanks,
>
> Steve

0
Reply Chris 8/5/2003 11:05:42 PM

I haven't done this in awhile, but I seem to recall having several portals
in a layout (all to the same related file).

To discriminate between them, I put into each portal at least one field name
from the related file that was unique compared to the other portals.  It
doesn't matter if you need it to show or not, it is just there so that the
Go To Field command goes to the right portal.  Then, once you're in the
portal, you can move from field to field & row to row.

If you don't want to see the unique field, make it small and hide it behind
some other field or object.

I trust that'll still work.

Dick Gascoigne
Singapore
(where there are more FMP developers than sheep) (one)

"Steve" <nospam@nospam.com> wrote in message
news:0001HW.BB55034D000EB44F09DFB670@text.giganews.com...
> I know you can create a new record in a Portal (actually in the related
file)
> by clicking on the next blank row and entering the corresponding data.
> However, I can't figure out how to do this within a script. "Go to last
row,
> Go to next row", for example, doesn't work. Hope I'm missing something
> obvious :-)
>
> Of course, I can add a script in the related file to make a new record and
> execute it from the original file, but the relationship field doesn't get
> automatically filled like it does if I create it from within the portal,
so I
> have to define globals, etc. to make that work. Not very convenient.
>
> Also, a related question: if you have multiple portals on a layout, how do
> you tell a script which one you are referring to in any given step?
>
> Thanks,
>
> Steve
>


0
Reply Dick 8/6/2003 10:22:44 AM

Peter <nomail@homeorwork.tnx> wrote:

> I forgot to mention that this only works if your portal does not yet
> contain any records. If it does, you should insert "Go to portal row
> [last]" before Set Field.

As far as I can tell adding that still doesn't work when you already
have one or more related posts.

So this would *not* work under that circumstance:

Go to Field [Select/Perform, "FieldName"]
Go to Portal Row [Select, Last]
Set field ["relatedDB::Field", "vVariable"]


The above instead changes the existing related fields data.

I abandoned this portalscripting approach and instead script everything
(as Eley hinted as a solution), including propagation of keys. I
couldn't conclude from the thread or elsewhere any ways to keep ability
to create new related posts without.
0
Reply michaellastname 11/1/2003 2:23:05 PM

6 Replies
520 Views

(page loaded in 0.065 seconds)

Similiar Articles:













7/23/2012 12:02:49 AM


Reply: