Portal Loop 
Author Message
 Portal Loop

Good Afternoon,

I'm having a problem that I'm sure someone her has been able to do. (I've
been working on it for about 3 hours and think I've figured out what the
problem is, but I don't know how to get past it).

I'm trying to copy the contents from 1 field in a multi-row portal to a
different portal in a different database.  For example, DBASE1 has a portal
which has 2 (or more) rows in it with a field, Part#.  Row 1 has part# A101,
Row 2 Has B202.

I'm trying to copy those part 3's to rows 1 and 2 in a portal in another
database.

I've tried looping thru the rows, but have since discovered that once the
copy function takes place and I go into the second database and come back to
the first, I can't get to the second row of the portal (or any subsequent
rows).

I think I need to refer the script to go by row #, but I'm not sure how to
do this.

Can anybody give me some direction here?

Thanks in advance!

Cody



Tue, 01 Feb 2005 02:49:58 GMT
 Portal Loop

I searched the archives and found the answer.

Thanks All.

Cody



Quote:
> Good Afternoon,

> I'm having a problem that I'm sure someone her has been able to do. (I've
> been working on it for about 3 hours and think I've figured out what the
> problem is, but I don't know how to get past it).

> I'm trying to copy the contents from 1 field in a multi-row portal to a
> different portal in a different database.  For example, DBASE1 has a
portal
> which has 2 (or more) rows in it with a field, Part#.  Row 1 has part#
A101,
> Row 2 Has B202.

> I'm trying to copy those part 3's to rows 1 and 2 in a portal in another
> database.

> I've tried looping thru the rows, but have since discovered that once the
> copy function takes place and I go into the second database and come back
to
> the first, I can't get to the second row of the portal (or any subsequent
> rows).

> I think I need to refer the script to go by row #, but I'm not sure how to
> do this.

> Can anybody give me some direction here?

> Thanks in advance!

> Cody



Tue, 01 Feb 2005 03:31:45 GMT
 Portal Loop
Cody,

avoid the copy function, use Set field. If this needs an intermediate global
holding field; so be it

Quote:

> I searched the archives and found the answer.

> Thanks All.

> Cody



> > Good Afternoon,

> > I'm having a problem that I'm sure someone her has been able to do. (I've
> > been working on it for about 3 hours and think I've figured out what the
> > problem is, but I don't know how to get past it).

> > I'm trying to copy the contents from 1 field in a multi-row portal to a
> > different portal in a different database.  For example, DBASE1 has a
> portal
> > which has 2 (or more) rows in it with a field, Part#.  Row 1 has part#
> A101,
> > Row 2 Has B202.

> > I'm trying to copy those part 3's to rows 1 and 2 in a portal in another
> > database.

> > I've tried looping thru the rows, but have since discovered that once the
> > copy function takes place and I go into the second database and come back
> to
> > the first, I can't get to the second row of the portal (or any subsequent
> > rows).

> > I think I need to refer the script to go by row #, but I'm not sure how to
> > do this.

> > Can anybody give me some direction here?

> > Thanks in advance!

> > Cody



Tue, 01 Feb 2005 07:43:29 GMT
 Portal Loop
Just Curious Chris...what's the advantage?

Cody


Quote:
> Cody,

> avoid the copy function, use Set field. If this needs an intermediate
global
> holding field; so be it


> > I searched the archives and found the answer.

> > Thanks All.

> > Cody



> > > Good Afternoon,

> > > I'm having a problem that I'm sure someone her has been able to do.
(I've
> > > been working on it for about 3 hours and think I've figured out what
the
> > > problem is, but I don't know how to get past it).

> > > I'm trying to copy the contents from 1 field in a multi-row portal to
a
> > > different portal in a different database.  For example, DBASE1 has a
> > portal
> > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has part#
> > A101,
> > > Row 2 Has B202.

> > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
another
> > > database.

> > > I've tried looping thru the rows, but have since discovered that once
the
> > > copy function takes place and I go into the second database and come
back
> > to
> > > the first, I can't get to the second row of the portal (or any
subsequent
> > > rows).

> > > I think I need to refer the script to go by row #, but I'm not sure
how to
> > > do this.

> > > Can anybody give me some direction here?

> > > Thanks in advance!

> > > Cody



Tue, 01 Feb 2005 10:15:06 GMT
 Portal Loop
Hi Cody,

copy and paste via clipboard can at times not transfer what you expect it too.
I learnt this the hard and frustrating way in earlier days. The solution was
set field. It is reliable. There have been a number of posts from those
knowledgable of the intracies of the internal mechanism and where copy/paste
falls over, none that I recall though for a couple of months.  A follow up post
next week when the clan is back from the devcon would yield more detailed info
I'm sure.

Using set field is one of those standard techniques, which require some defence
or special circumstance to use anything other ; at least as I have come to
understand from the group.

Adopting the intermediate global hold field will allow maybe a bit of alternate
design thinking at times too. It can be a really good way to set temporary
relationships. It is also a means of moving repeating field data (were one to
have such) into  a related db; creating individual records from each
repitition. One of things that once you get familiar with it, you tend to find
more uses.

regards

Chris

Chris Brown
Dept. Neurosurgery
University of Adelaide

Quote:

> Just Curious Chris...what's the advantage?

> Cody



> > Cody,

> > avoid the copy function, use Set field. If this needs an intermediate
> global
> > holding field; so be it


> > > I searched the archives and found the answer.

> > > Thanks All.

> > > Cody



> > > > Good Afternoon,

> > > > I'm having a problem that I'm sure someone her has been able to do.
> (I've
> > > > been working on it for about 3 hours and think I've figured out what
> the
> > > > problem is, but I don't know how to get past it).

> > > > I'm trying to copy the contents from 1 field in a multi-row portal to
> a
> > > > different portal in a different database.  For example, DBASE1 has a
> > > portal
> > > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has part#
> > > A101,
> > > > Row 2 Has B202.

> > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
> another
> > > > database.

> > > > I've tried looping thru the rows, but have since discovered that once
> the
> > > > copy function takes place and I go into the second database and come
> back
> > > to
> > > > the first, I can't get to the second row of the portal (or any
> subsequent
> > > > rows).

> > > > I think I need to refer the script to go by row #, but I'm not sure
> how to
> > > > do this.

> > > > Can anybody give me some direction here?

> > > > Thanks in advance!

> > > > Cody



Tue, 01 Feb 2005 11:54:59 GMT
 Portal Loop
I was going to offer the same response as Chris, but he beat me to it.  

One advantage to using Set Field over copy and paste is that your users
won't lose whatever they had on their clipboard before your script
mucked with it.

Another advantage -- particularly when dealing with portals is that a
set field doesn't have to leave the portal row to do it's job.  If you
were setting globals, you could just set your global, go next row, set
another global, etc.

Third advantage is that fields don't have to be on a layout for Set
Field, whereas they do for copy and paste.  The data you usually want
transferred in such situations is a primary ID field.  Since primary IDs
are very infrequently displayed on any user layouts, Set Field is the
way to go.

Using Set Field, you can go row to row setting globals, as I mentioned.
But since you are using the portal data to create new records in another
file, here's how I would go about the task:

a) From the portal in File_1, perform a go to related records (GTRR)
using the portal's relationship and 'show only related' records.  

b) In that related file (File_2), loop through the found set (which
after the GTRR should only be the records that were showing in the
portal).  This file can remain on a splash screen or blank layout, if
that's what's convenient.

c) For each record in the loop, perform a Set Field to the third file
(File_3) where you will be creating new records.  For each record in
File_2, you will go through all the fields you want to transfer, using a
'set field' for each.

Here's the cool part: your set fields in File_2 can automatically create
the new related records in File_3.  Here's how to set that part up:

 1) Create a new relationship (I'll call it "File3_NewRecord") from
File_2 to File_3, from a constant calc field (=1) to a field called
NewRecordFlag.  The NewRecordFlag field (in File_3) should be a number
field.  Set the relationship to allow creation of new records.

 2) Now go through your SetField steps, something like:
    SetField[File3_NewRecord::Company, Company]
    SetField[File3_NewRecord::City, City]
    SetField[File3_NewRecord::FavoriteBeers, FavoriteBeers]

 3) After all your required Set Fields for each record, add one last
one:
    SetField[File3_NewRecord::NewRecordFlag, ""]

That last step resets that record so that it is no longer recognized by
the File3_NewRecord relationship.  Now, as you go to the next record in
your loop, the next SetField using the File3_NewRecord relationship will
automatically create a new record because no other records have the
NewRecordFlag set.

I understand that this may be a bit confusing.  But try setting it up
and you'll get a better idea of how it works and of how simple it really
is.  Let me know if you have any additional questions on it.

Quote:

> Just Curious Chris...what's the advantage?

> Cody



> > Cody,

> > avoid the copy function, use Set field. If this needs an intermediate
> global
> > holding field; so be it


> > > I searched the archives and found the answer.

> > > Thanks All.

> > > Cody



> > > > Good Afternoon,

> > > > I'm having a problem that I'm sure someone her has been able to do.
> (I've
> > > > been working on it for about 3 hours and think I've figured out what
> the
> > > > problem is, but I don't know how to get past it).

> > > > I'm trying to copy the contents from 1 field in a multi-row portal to
> a
> > > > different portal in a different database.  For example, DBASE1 has a
> > > portal
> > > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has part#
> > > A101,
> > > > Row 2 Has B202.

> > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
> another
> > > > database.

> > > > I've tried looping thru the rows, but have since discovered that once
> the
> > > > copy function takes place and I go into the second database and come
> back
> > > to
> > > > the first, I can't get to the second row of the portal (or any
> subsequent
> > > > rows).

> > > > I think I need to refer the script to go by row #, but I'm not sure
> how to
> > > > do this.

> > > > Can anybody give me some direction here?

> > > > Thanks in advance!

> > > > Cody

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 321-5176
FM Pro Solutions       Los Angeles, California
Associate Member, FileMaker Solutions Alliance


Tue, 01 Feb 2005 11:51:27 GMT
 Portal Loop
Hi Guys,

one thing I would add to Howard's detailed explanation, is that the new record
flag concept, and rewriting it to a different value, is the basis of a very handy
method for using an existing list of ID numbers as a lookup table, an alternate
to serial auto enter.... I use a Status "a" (available/unassigned), and write it
to "b" . This also picks up the next unassigned number in a series, i.e. picks up
discontinuities ...

regrads

Chris

Quote:

> I was going to offer the same response as Chris, but he beat me to it.

> One advantage to using Set Field over copy and paste is that your users
> won't lose whatever they had on their clipboard before your script
> mucked with it.

> Another advantage -- particularly when dealing with portals is that a
> set field doesn't have to leave the portal row to do it's job.  If you
> were setting globals, you could just set your global, go next row, set
> another global, etc.

> Third advantage is that fields don't have to be on a layout for Set
> Field, whereas they do for copy and paste.  The data you usually want
> transferred in such situations is a primary ID field.  Since primary IDs
> are very infrequently displayed on any user layouts, Set Field is the
> way to go.

> Using Set Field, you can go row to row setting globals, as I mentioned.
> But since you are using the portal data to create new records in another
> file, here's how I would go about the task:

> a) From the portal in File_1, perform a go to related records (GTRR)
> using the portal's relationship and 'show only related' records.

> b) In that related file (File_2), loop through the found set (which
> after the GTRR should only be the records that were showing in the
> portal).  This file can remain on a splash screen or blank layout, if
> that's what's convenient.

> c) For each record in the loop, perform a Set Field to the third file
> (File_3) where you will be creating new records.  For each record in
> File_2, you will go through all the fields you want to transfer, using a
> 'set field' for each.

> Here's the cool part: your set fields in File_2 can automatically create
> the new related records in File_3.  Here's how to set that part up:

>  1) Create a new relationship (I'll call it "File3_NewRecord") from
> File_2 to File_3, from a constant calc field (=1) to a field called
> NewRecordFlag.  The NewRecordFlag field (in File_3) should be a number
> field.  Set the relationship to allow creation of new records.

>  2) Now go through your SetField steps, something like:
>     SetField[File3_NewRecord::Company, Company]
>     SetField[File3_NewRecord::City, City]
>     SetField[File3_NewRecord::FavoriteBeers, FavoriteBeers]

>  3) After all your required Set Fields for each record, add one last
> one:
>     SetField[File3_NewRecord::NewRecordFlag, ""]

> That last step resets that record so that it is no longer recognized by
> the File3_NewRecord relationship.  Now, as you go to the next record in
> your loop, the next SetField using the File3_NewRecord relationship will
> automatically create a new record because no other records have the
> NewRecordFlag set.

> I understand that this may be a bit confusing.  But try setting it up
> and you'll get a better idea of how it works and of how simple it really
> is.  Let me know if you have any additional questions on it.


> > Just Curious Chris...what's the advantage?

> > Cody



> > > Cody,

> > > avoid the copy function, use Set field. If this needs an intermediate
> > global
> > > holding field; so be it


> > > > I searched the archives and found the answer.

> > > > Thanks All.

> > > > Cody



> > > > > Good Afternoon,

> > > > > I'm having a problem that I'm sure someone her has been able to do.
> > (I've
> > > > > been working on it for about 3 hours and think I've figured out what
> > the
> > > > > problem is, but I don't know how to get past it).

> > > > > I'm trying to copy the contents from 1 field in a multi-row portal to
> > a
> > > > > different portal in a different database.  For example, DBASE1 has a
> > > > portal
> > > > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has part#
> > > > A101,
> > > > > Row 2 Has B202.

> > > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
> > another
> > > > > database.

> > > > > I've tried looping thru the rows, but have since discovered that once
> > the
> > > > > copy function takes place and I go into the second database and come
> > back
> > > > to
> > > > > the first, I can't get to the second row of the portal (or any
> > subsequent
> > > > > rows).

> > > > > I think I need to refer the script to go by row #, but I'm not sure
> > how to
> > > > > do this.

> > > > > Can anybody give me some direction here?

> > > > > Thanks in advance!

> > > > > Cody

> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Howard Schlossberg              (818) 321-5176
> FM Pro Solutions       Los Angeles, California
> Associate Member, FileMaker Solutions Alliance



Tue, 01 Feb 2005 12:19:30 GMT
 Portal Loop
Thanks Both Chris and Howard.

Thanks for the detailed explanation and it's working as promised with one
exception.  Let me explain better what I'm actually doing here:

I'm creating an order entry system that will allow me to create a Quote for
a customer.  When the customer sends me a P.O. for the order, I'm creating
an Order from the Quote, (and eventually the order will be used to create an
Invoice(s).).  My structure is as such: 4 files; File1 is the Quote, File 2
is the QuoteLineItems, File 3 is the Order, File 4 is the OrderLineItems.

The script takes the Part#s from the QuoteLineItems file, creates the Order,
and places the Parts#'s into the OrderLineItems file.  So far, so good.
However...the customer may send me multiple P.O.s generated from the single
quote, (this happens quite a lot...I sell alot of hardware and software to
corporate business' which may use the same quote for multiple purchases for
1 or more shipping locations).

So what's happening with this script is that when I try to create a second
order from the original quote, it creates a new Order record but places the
Part#'s in the first order, not the second.  I think the problem lies with
the NewRecordFlag.  Correction...I just discovered that it does the same
thing even when I use a different Quote #.

What am I doing wrong here?

I'll post the script steps in a separate post.

Thanks Again!

Cody


Quote:
> I was going to offer the same response as Chris, but he beat me to it.

> One advantage to using Set Field over copy and paste is that your users
> won't lose whatever they had on their clipboard before your script
> mucked with it.

> Another advantage -- particularly when dealing with portals is that a
> set field doesn't have to leave the portal row to do it's job.  If you
> were setting globals, you could just set your global, go next row, set
> another global, etc.

> Third advantage is that fields don't have to be on a layout for Set
> Field, whereas they do for copy and paste.  The data you usually want
> transferred in such situations is a primary ID field.  Since primary IDs
> are very infrequently displayed on any user layouts, Set Field is the
> way to go.

> Using Set Field, you can go row to row setting globals, as I mentioned.
> But since you are using the portal data to create new records in another
> file, here's how I would go about the task:

> a) From the portal in File_1, perform a go to related records (GTRR)
> using the portal's relationship and 'show only related' records.

> b) In that related file (File_2), loop through the found set (which
> after the GTRR should only be the records that were showing in the
> portal).  This file can remain on a splash screen or blank layout, if
> that's what's convenient.

> c) For each record in the loop, perform a Set Field to the third file
> (File_3) where you will be creating new records.  For each record in
> File_2, you will go through all the fields you want to transfer, using a
> 'set field' for each.

> Here's the cool part: your set fields in File_2 can automatically create
> the new related records in File_3.  Here's how to set that part up:

>  1) Create a new relationship (I'll call it "File3_NewRecord") from
> File_2 to File_3, from a constant calc field (=1) to a field called
> NewRecordFlag.  The NewRecordFlag field (in File_3) should be a number
> field.  Set the relationship to allow creation of new records.

>  2) Now go through your SetField steps, something like:
>     SetField[File3_NewRecord::Company, Company]
>     SetField[File3_NewRecord::City, City]
>     SetField[File3_NewRecord::FavoriteBeers, FavoriteBeers]

>  3) After all your required Set Fields for each record, add one last
> one:
>     SetField[File3_NewRecord::NewRecordFlag, ""]

> That last step resets that record so that it is no longer recognized by
> the File3_NewRecord relationship.  Now, as you go to the next record in
> your loop, the next SetField using the File3_NewRecord relationship will
> automatically create a new record because no other records have the
> NewRecordFlag set.

> I understand that this may be a bit confusing.  But try setting it up
> and you'll get a better idea of how it works and of how simple it really
> is.  Let me know if you have any additional questions on it.


> > Just Curious Chris...what's the advantage?

> > Cody



> > > Cody,

> > > avoid the copy function, use Set field. If this needs an intermediate
> > global
> > > holding field; so be it


> > > > I searched the archives and found the answer.

> > > > Thanks All.

> > > > Cody



> > > > > Good Afternoon,

> > > > > I'm having a problem that I'm sure someone her has been able to
do.
> > (I've
> > > > > been working on it for about 3 hours and think I've figured out
what
> > the
> > > > > problem is, but I don't know how to get past it).

> > > > > I'm trying to copy the contents from 1 field in a multi-row portal
to
> > a
> > > > > different portal in a different database.  For example, DBASE1 has
a
> > > > portal
> > > > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has
part#
> > > > A101,
> > > > > Row 2 Has B202.

> > > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
> > another
> > > > > database.

> > > > > I've tried looping thru the rows, but have since discovered that
once
> > the
> > > > > copy function takes place and I go into the second database and
come
> > back
> > > > to
> > > > > the first, I can't get to the second row of the portal (or any
> > subsequent
> > > > > rows).

> > > > > I think I need to refer the script to go by row #, but I'm not
sure
> > how to
> > > > > do this.

> > > > > Can anybody give me some direction here?

> > > > > Thanks in advance!

> > > > > Cody

> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Howard Schlossberg              (818) 321-5176
> FM Pro Solutions       Los Angeles, California
> Associate Member, FileMaker Solutions Alliance



Tue, 01 Feb 2005 23:27:05 GMT
 Portal Loop
Here are the script steps:

#Starting from the GTRR file (QuoteLineItems):
    Go to Record/Request/Page (First)
    Set Field (gPart#, Part#)    #places the 1st part# into a global then
calls a script from the Order file.

    Perform Script (Filename: "Orders.fp5", "Set Fields from Quote")
(Sub-scripts)
            #Here's that Script:  It finds the first available empty row in
the portal and sets the Part# value from the global
                    Loop
                        Go to Field (OrdersLN::Part#) (select/perform)
                        Exit Loop If (OrdersLN::Part# = "")
                        If (OrdersLN::Part# > "")
                            Go To Portal Row (Next)
                        End If
                    End Loop
                    Set Field (OrdersLN::Part#, QuotesLN::gPart#)  # This is
the end of this script.

    #Now it comes back to the original script in the QuotesLineItems File
and loops through to the next Part# and repeats                 the above
process.

    Loop
        Go to Record/Request/Page (Next, Exit after last)
        Set Field (gPart#, Part#)
        Perform Script (Filename: "Orders.fp5", "Set Fields from Quote")
(Sub-scripts)
    End Loop

    Set Field (NewRecord::NewRecordFlag, "")

Where am I going wrong?

Thanks Much!

Cody


Quote:
> I was going to offer the same response as Chris, but he beat me to it.

> One advantage to using Set Field over copy and paste is that your users
> won't lose whatever they had on their clipboard before your script
> mucked with it.

> Another advantage -- particularly when dealing with portals is that a
> set field doesn't have to leave the portal row to do it's job.  If you
> were setting globals, you could just set your global, go next row, set
> another global, etc.

> Third advantage is that fields don't have to be on a layout for Set
> Field, whereas they do for copy and paste.  The data you usually want
> transferred in such situations is a primary ID field.  Since primary IDs
> are very infrequently displayed on any user layouts, Set Field is the
> way to go.

> Using Set Field, you can go row to row setting globals, as I mentioned.
> But since you are using the portal data to create new records in another
> file, here's how I would go about the task:

> a) From the portal in File_1, perform a go to related records (GTRR)
> using the portal's relationship and 'show only related' records.

> b) In that related file (File_2), loop through the found set (which
> after the GTRR should only be the records that were showing in the
> portal).  This file can remain on a splash screen or blank layout, if
> that's what's convenient.

> c) For each record in the loop, perform a Set Field to the third file
> (File_3) where you will be creating new records.  For each record in
> File_2, you will go through all the fields you want to transfer, using a
> 'set field' for each.

> Here's the cool part: your set fields in File_2 can automatically create
> the new related records in File_3.  Here's how to set that part up:

>  1) Create a new relationship (I'll call it "File3_NewRecord") from
> File_2 to File_3, from a constant calc field (=1) to a field called
> NewRecordFlag.  The NewRecordFlag field (in File_3) should be a number
> field.  Set the relationship to allow creation of new records.

>  2) Now go through your SetField steps, something like:
>     SetField[File3_NewRecord::Company, Company]
>     SetField[File3_NewRecord::City, City]
>     SetField[File3_NewRecord::FavoriteBeers, FavoriteBeers]

>  3) After all your required Set Fields for each record, add one last
> one:
>     SetField[File3_NewRecord::NewRecordFlag, ""]

> That last step resets that record so that it is no longer recognized by
> the File3_NewRecord relationship.  Now, as you go to the next record in
> your loop, the next SetField using the File3_NewRecord relationship will
> automatically create a new record because no other records have the
> NewRecordFlag set.

> I understand that this may be a bit confusing.  But try setting it up
> and you'll get a better idea of how it works and of how simple it really
> is.  Let me know if you have any additional questions on it.


> > Just Curious Chris...what's the advantage?

> > Cody



> > > Cody,

> > > avoid the copy function, use Set field. If this needs an intermediate
> > global
> > > holding field; so be it


> > > > I searched the archives and found the answer.

> > > > Thanks All.

> > > > Cody



> > > > > Good Afternoon,

> > > > > I'm having a problem that I'm sure someone her has been able to
do.
> > (I've
> > > > > been working on it for about 3 hours and think I've figured out
what
> > the
> > > > > problem is, but I don't know how to get past it).

> > > > > I'm trying to copy the contents from 1 field in a multi-row portal
to
> > a
> > > > > different portal in a different database.  For example, DBASE1 has
a
> > > > portal
> > > > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has
part#
> > > > A101,
> > > > > Row 2 Has B202.

> > > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
> > another
> > > > > database.

> > > > > I've tried looping thru the rows, but have since discovered that
once
> > the
> > > > > copy function takes place and I go into the second database and
come
> > back
> > > > to
> > > > > the first, I can't get to the second row of the portal (or any
> > subsequent
> > > > > rows).

> > > > > I think I need to refer the script to go by row #, but I'm not
sure
> > how to
> > > > > do this.

> > > > > Can anybody give me some direction here?

> > > > > Thanks in advance!

> > > > > Cody

> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Howard Schlossberg              (818) 321-5176
> FM Pro Solutions       Los Angeles, California
> Associate Member, FileMaker Solutions Alliance



Tue, 01 Feb 2005 23:48:45 GMT
 Portal Loop
I don't see where you are using the "NewRecord" relationship to really
create valid new fields.  Please explain what you are using for your
OrdersLN and QuotesLN relationships.    It looks like you are still
looping through rows, which is somewhat unnecessary if you are using
GTRR.  

In it's simplest form of moving a quote and it's line items into a new
order and new order line items, try something like this:

# Run from the Quotes file
# Scriptname: Convert Quote to Order
# create a new order and move the QuoteID over
Set Field [OrdersNew::QuoteID, QuoteID]
# Grab the new order's ID for later creation of order line items
Set Field [gOrderID, OrdersNew::OrderID]
# Clear the NewRecordFlag so that the next time we use the
# OrdersNew relationship, a new order will be created.
Set Field [OrdersNew::NewRecordFlag, ""]
# Go to the Quote's related line items
Go To Related Records [QuoteLineItems, Show Only Related]
# Now do the same thing with the Quote Line Items
Perform Script [External, QuoteLines.fp5, "Convert Quote Lines to Order
Lines"]
# Bring focus back to the Quotes file after all scripts are run
Exit Script

# Run from QuoteLines file
# Scriptname: Convert Quote Lines to Order Lines
Goto Record [First]
Loop
  Set Field [OrderLineNew::QuoteLineID, QuoteLineID]
  Set Field [OrderLineNew::OrderID, Quotes::gOrderID]
  Set Field [OrderLineNew::PartID, PartID]
  Set Field [OrderLineNew::Price, Price]
  Set Field [OrderLineNew::NewRecordFlag, ""]
  Goto Record [Next, exit after last]
End Loop

This is obviously shorter than it appears with all the comments.
Although I went through the series of Set Fields for each line item, you
could have just as well set the necessary fields in OrderLines as
lookups back to QuoteLines based on QuoteLineID.  That way, once the
OrderID and QuoteLineID were set in the OrderLines file, all other info
(PartID, Price, etc) will fill in automatically from the quote.

I hope this all makes a little more sense then my last convoluted post.  

Howard

Quote:

> Here are the script steps:

> #Starting from the GTRR file (QuoteLineItems):
>     Go to Record/Request/Page (First)
>     Set Field (gPart#, Part#)    #places the 1st part# into a global then
> calls a script from the Order file.

>     Perform Script (Filename: "Orders.fp5", "Set Fields from Quote")
> (Sub-scripts)
>             #Here's that Script:  It finds the first available empty row in
> the portal and sets the Part# value from the global
>                     Loop
>                         Go to Field (OrdersLN::Part#) (select/perform)
>                         Exit Loop If (OrdersLN::Part# = "")
>                         If (OrdersLN::Part# > "")
>                             Go To Portal Row (Next)
>                         End If
>                     End Loop
>                     Set Field (OrdersLN::Part#, QuotesLN::gPart#)  # This is
> the end of this script.

>     #Now it comes back to the original script in the QuotesLineItems File
> and loops through to the next Part# and repeats                 the above
> process.

>     Loop
>         Go to Record/Request/Page (Next, Exit after last)
>         Set Field (gPart#, Part#)
>         Perform Script (Filename: "Orders.fp5", "Set Fields from Quote")
> (Sub-scripts)
>     End Loop

>     Set Field (NewRecord::NewRecordFlag, "")

> Where am I going wrong?

> Thanks Much!

> Cody



> > I was going to offer the same response as Chris, but he beat me to it.

> > One advantage to using Set Field over copy and paste is that your users
> > won't lose whatever they had on their clipboard before your script
> > mucked with it.

> > Another advantage -- particularly when dealing with portals is that a
> > set field doesn't have to leave the portal row to do it's job.  If you
> > were setting globals, you could just set your global, go next row, set
> > another global, etc.

> > Third advantage is that fields don't have to be on a layout for Set
> > Field, whereas they do for copy and paste.  The data you usually want
> > transferred in such situations is a primary ID field.  Since primary IDs
> > are very infrequently displayed on any user layouts, Set Field is the
> > way to go.

> > Using Set Field, you can go row to row setting globals, as I mentioned.
> > But since you are using the portal data to create new records in another
> > file, here's how I would go about the task:

> > a) From the portal in File_1, perform a go to related records (GTRR)
> > using the portal's relationship and 'show only related' records.

> > b) In that related file (File_2), loop through the found set (which
> > after the GTRR should only be the records that were showing in the
> > portal).  This file can remain on a splash screen or blank layout, if
> > that's what's convenient.

> > c) For each record in the loop, perform a Set Field to the third file
> > (File_3) where you will be creating new records.  For each record in
> > File_2, you will go through all the fields you want to transfer, using a
> > 'set field' for each.

> > Here's the cool part: your set fields in File_2 can automatically create
> > the new related records in File_3.  Here's how to set that part up:

> >  1) Create a new relationship (I'll call it "File3_NewRecord") from
> > File_2 to File_3, from a constant calc field (=1) to a field called
> > NewRecordFlag.  The NewRecordFlag field (in File_3) should be a number
> > field.  Set the relationship to allow creation of new records.

> >  2) Now go through your SetField steps, something like:
> >     SetField[File3_NewRecord::Company, Company]
> >     SetField[File3_NewRecord::City, City]
> >     SetField[File3_NewRecord::FavoriteBeers, FavoriteBeers]

> >  3) After all your required Set Fields for each record, add one last
> > one:
> >     SetField[File3_NewRecord::NewRecordFlag, ""]

> > That last step resets that record so that it is no longer recognized by
> > the File3_NewRecord relationship.  Now, as you go to the next record in
> > your loop, the next SetField using the File3_NewRecord relationship will
> > automatically create a new record because no other records have the
> > NewRecordFlag set.

> > I understand that this may be a bit confusing.  But try setting it up
> > and you'll get a better idea of how it works and of how simple it really
> > is.  Let me know if you have any additional questions on it.


> > > Just Curious Chris...what's the advantage?

> > > Cody



> > > > Cody,

> > > > avoid the copy function, use Set field. If this needs an intermediate
> > > global
> > > > holding field; so be it


> > > > > I searched the archives and found the answer.

> > > > > Thanks All.

> > > > > Cody



> > > > > > Good Afternoon,

> > > > > > I'm having a problem that I'm sure someone her has been able to
> do.
> > > (I've
> > > > > > been working on it for about 3 hours and think I've figured out
> what
> > > the
> > > > > > problem is, but I don't know how to get past it).

> > > > > > I'm trying to copy the contents from 1 field in a multi-row portal
> to
> > > a
> > > > > > different portal in a different database.  For example, DBASE1 has
> a
> > > > > portal
> > > > > > which has 2 (or more) rows in it with a field, Part#.  Row 1 has
> part#
> > > > > A101,
> > > > > > Row 2 Has B202.

> > > > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal in
> > > another
> > > > > > database.

> > > > > > I've tried looping thru the rows, but have since discovered that
> once
> > > the
> > > > > > copy function takes place and I go into the second database and
> come
> > > back
> > > > > to
> > > > > > the first, I can't get to the second row of the portal (or any
> > > subsequent
> > > > > > rows).

> > > > > > I think I need to refer the script to go by row #, but I'm not
> sure
> > > how to
> > > > > > do this.

> > > > > > Can anybody give me some direction here?

> > > > > > Thanks in advance!

> > > > > > Cody

> > --
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Howard Schlossberg              (818) 321-5176
> > FM Pro Solutions       Los Angeles, California
> > Associate Member, FileMaker Solutions Alliance

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 321-5176
FM Pro Solutions       Los Angeles, California
Associate Member, FileMaker Solutions Alliance


Wed, 02 Feb 2005 03:10:00 GMT
 Portal Loop
Good Morning Howard,

I didn't show the previous script steps where the I was creating a new
record in the Orders file.  Be that as it may, I think I misunderstood part
of your original post-reply and was adding the Order Line Items through the
Portal in the Order file...thus the looping thru the rows.

I'm now following your last suggeation and it's working perfectly.

Thank you VERY much!

Cody


Quote:
> I don't see where you are using the "NewRecord" relationship to really
> create valid new fields.  Please explain what you are using for your
> OrdersLN and QuotesLN relationships.    It looks like you are still
> looping through rows, which is somewhat unnecessary if you are using
> GTRR.

> In it's simplest form of moving a quote and it's line items into a new
> order and new order line items, try something like this:

> # Run from the Quotes file
> # Scriptname: Convert Quote to Order
> # create a new order and move the QuoteID over
> Set Field [OrdersNew::QuoteID, QuoteID]
> # Grab the new order's ID for later creation of order line items
> Set Field [gOrderID, OrdersNew::OrderID]
> # Clear the NewRecordFlag so that the next time we use the
> # OrdersNew relationship, a new order will be created.
> Set Field [OrdersNew::NewRecordFlag, ""]
> # Go to the Quote's related line items
> Go To Related Records [QuoteLineItems, Show Only Related]
> # Now do the same thing with the Quote Line Items
> Perform Script [External, QuoteLines.fp5, "Convert Quote Lines to Order
> Lines"]
> # Bring focus back to the Quotes file after all scripts are run
> Exit Script

> # Run from QuoteLines file
> # Scriptname: Convert Quote Lines to Order Lines
> Goto Record [First]
> Loop
>   Set Field [OrderLineNew::QuoteLineID, QuoteLineID]
>   Set Field [OrderLineNew::OrderID, Quotes::gOrderID]
>   Set Field [OrderLineNew::PartID, PartID]
>   Set Field [OrderLineNew::Price, Price]
>   Set Field [OrderLineNew::NewRecordFlag, ""]
>   Goto Record [Next, exit after last]
> End Loop

> This is obviously shorter than it appears with all the comments.
> Although I went through the series of Set Fields for each line item, you
> could have just as well set the necessary fields in OrderLines as
> lookups back to QuoteLines based on QuoteLineID.  That way, once the
> OrderID and QuoteLineID were set in the OrderLines file, all other info
> (PartID, Price, etc) will fill in automatically from the quote.

> I hope this all makes a little more sense then my last convoluted post.

> Howard


> > Here are the script steps:

> > #Starting from the GTRR file (QuoteLineItems):
> >     Go to Record/Request/Page (First)
> >     Set Field (gPart#, Part#)    #places the 1st part# into a global
then
> > calls a script from the Order file.

> >     Perform Script (Filename: "Orders.fp5", "Set Fields from Quote")
> > (Sub-scripts)
> >             #Here's that Script:  It finds the first available empty row
in
> > the portal and sets the Part# value from the global
> >                     Loop
> >                         Go to Field (OrdersLN::Part#) (select/perform)
> >                         Exit Loop If (OrdersLN::Part# = "")
> >                         If (OrdersLN::Part# > "")
> >                             Go To Portal Row (Next)
> >                         End If
> >                     End Loop
> >                     Set Field (OrdersLN::Part#, QuotesLN::gPart#)  #
This is
> > the end of this script.

> >     #Now it comes back to the original script in the QuotesLineItems
File
> > and loops through to the next Part# and repeats                 the
above
> > process.

> >     Loop
> >         Go to Record/Request/Page (Next, Exit after last)
> >         Set Field (gPart#, Part#)
> >         Perform Script (Filename: "Orders.fp5", "Set Fields from Quote")
> > (Sub-scripts)
> >     End Loop

> >     Set Field (NewRecord::NewRecordFlag, "")

> > Where am I going wrong?

> > Thanks Much!

> > Cody



> > > I was going to offer the same response as Chris, but he beat me to it.

> > > One advantage to using Set Field over copy and paste is that your
users
> > > won't lose whatever they had on their clipboard before your script
> > > mucked with it.

> > > Another advantage -- particularly when dealing with portals is that a
> > > set field doesn't have to leave the portal row to do it's job.  If you
> > > were setting globals, you could just set your global, go next row, set
> > > another global, etc.

> > > Third advantage is that fields don't have to be on a layout for Set
> > > Field, whereas they do for copy and paste.  The data you usually want
> > > transferred in such situations is a primary ID field.  Since primary
IDs
> > > are very infrequently displayed on any user layouts, Set Field is the
> > > way to go.

> > > Using Set Field, you can go row to row setting globals, as I
mentioned.
> > > But since you are using the portal data to create new records in
another
> > > file, here's how I would go about the task:

> > > a) From the portal in File_1, perform a go to related records (GTRR)
> > > using the portal's relationship and 'show only related' records.

> > > b) In that related file (File_2), loop through the found set (which
> > > after the GTRR should only be the records that were showing in the
> > > portal).  This file can remain on a splash screen or blank layout, if
> > > that's what's convenient.

> > > c) For each record in the loop, perform a Set Field to the third file
> > > (File_3) where you will be creating new records.  For each record in
> > > File_2, you will go through all the fields you want to transfer, using
a
> > > 'set field' for each.

> > > Here's the cool part: your set fields in File_2 can automatically
create
> > > the new related records in File_3.  Here's how to set that part up:

> > >  1) Create a new relationship (I'll call it "File3_NewRecord") from
> > > File_2 to File_3, from a constant calc field (=1) to a field called
> > > NewRecordFlag.  The NewRecordFlag field (in File_3) should be a number
> > > field.  Set the relationship to allow creation of new records.

> > >  2) Now go through your SetField steps, something like:
> > >     SetField[File3_NewRecord::Company, Company]
> > >     SetField[File3_NewRecord::City, City]
> > >     SetField[File3_NewRecord::FavoriteBeers, FavoriteBeers]

> > >  3) After all your required Set Fields for each record, add one last
> > > one:
> > >     SetField[File3_NewRecord::NewRecordFlag, ""]

> > > That last step resets that record so that it is no longer recognized
by
> > > the File3_NewRecord relationship.  Now, as you go to the next record
in
> > > your loop, the next SetField using the File3_NewRecord relationship
will
> > > automatically create a new record because no other records have the
> > > NewRecordFlag set.

> > > I understand that this may be a bit confusing.  But try setting it up
> > > and you'll get a better idea of how it works and of how simple it
really
> > > is.  Let me know if you have any additional questions on it.


> > > > Just Curious Chris...what's the advantage?

> > > > Cody



> > > > > Cody,

> > > > > avoid the copy function, use Set field. If this needs an
intermediate
> > > > global
> > > > > holding field; so be it


> > > > > > I searched the archives and found the answer.

> > > > > > Thanks All.

> > > > > > Cody



> > > > > > > Good Afternoon,

> > > > > > > I'm having a problem that I'm sure someone her has been able
to
> > do.
> > > > (I've
> > > > > > > been working on it for about 3 hours and think I've figured
out
> > what
> > > > the
> > > > > > > problem is, but I don't know how to get past it).

> > > > > > > I'm trying to copy the contents from 1 field in a multi-row
portal
> > to
> > > > a
> > > > > > > different portal in a different database.  For example, DBASE1
has
> > a
> > > > > > portal
> > > > > > > which has 2 (or more) rows in it with a field, Part#.  Row 1
has
> > part#
> > > > > > A101,
> > > > > > > Row 2 Has B202.

> > > > > > > I'm trying to copy those part 3's to rows 1 and 2 in a portal
in
> > > > another
> > > > > > > database.

> > > > > > > I've tried looping thru the rows, but have since discovered
that
> > once
> > > > the
> > > > > > > copy function takes place and I go into the second database
and
> > come
> > > > back
> > > > > > to
> > > > > > > the first, I can't get to the second row of the portal (or any
> > > > subsequent
> > > > > > > rows).

> > > > > > > I think I need to refer the script to go by row #, but I'm not
> > sure
> > > > how to
> > > > > > > do this.

> > > > > > > Can anybody give me some direction here?

> > > > > > > Thanks in advance!

> > > > > > > Cody

> > > --
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Howard Schlossberg              (818) 321-5176
> > > FM Pro Solutions       Los Angeles, California
> > > Associate Member, FileMaker Solutions Alliance

> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Howard Schlossberg              (818) 321-5176
> FM Pro Solutions       Los Angeles, California
> Associate Member, FileMaker Solutions Alliance

...

read more »



Wed, 02 Feb 2005 20:58:39 GMT
 
 [ 11 post ] 

 Relevant Pages 

1. Looping within a Loop

2. Loops will not loop any more

3. Help Help For Loops and incrementing fields each loop

4. Need help with a loop script (won't loop)

5. HELP (VFP3) My Loop Doesn't Loop?

6. Oracle Portal vs Novell Portal

7. To Portal or not to Portal

8. Add item in line item portal from another portal

9. FILTER PORTAL RECORDS - DISABLE ADDING NEW RECORDS IN A PORTAL

10. Copy Portal to Portal

11. Displaying a portal based on a portal

12. Portal for line of data in a portal?


 
Powered by phpBB® Forum Software