Without the context above, what you are trying to be done can be achieved by the "go to related records" script step. As long as you are looking to create a record for each of the records in the related table.
For example, I have Table A with a portal of records from Table B, and I want to create a new record in Table C for every related record in Table B.
From Table A, my button would perform this script:
-GoTo Related Records from Table B, using a Table B layout, related to current record only (not found set).
-GoTo Record - First
--Set variable $data with my data to create Table C records
--GoTo Table C layout
--Set field to set data from $data
--GoTo Table B layout
--GoTo next record, exit after last
GoTo Table A Layout
since both Table A and Table B will remember your found sets and record location, you can use this type of scripting.
Hope this gets you started in the right direction.
I am wanting to create a new record for every row in the portal. Each row represents the total of a particular product that needs to be removed from my current inventory. The way I have my Stock Transactions layout setup is each record relates to one particular product.
I am attaching screenshots to help give some info and context to everything.
1. Screenshot of my Tables and their occurences
2. Screenshot of Relationship Graph and Table Occurrences
3. Portal I'm wanting to create new records from. These new records will be created in the Stock Transactions layout. Each size will be its own new record.
4. Stock Transactions layout. I have manually added the records that I would want this button to automatically create based on the portal that you see in the above screenshot.
I hope this helps and makes sense. If the suggestions you initially posted are still how you would do it, let me know and I'll work on getting my brain around it all. Thanks a lot!
I am wanting to create a new record for every row in the portal.
This is what I explained how to do. I just illustrated it without context so it would be easier to digest.
In your context using my example, Table A would be Customers, Table B would be your Inventory table and Table C would be your transactions table.
Ok gotcha. I'll read over it some more.
Here is how I think Table A, B, and C are in my context:
Table A - Jobs
Table B - Filters Needed
Table C - Stock Transactions
"Jobs" is where my portal is, and the portal is pulling from "Filters Needed". The new records will be created in "Stock Transactions".
Ok also here's another general question regarding the portal and script steps involved.
When I leave the portal and create a new record in the other layout, when I Loop back around and return to the portal, how do I tell it to go to the 2nd row and keep the process going? Then the 3rd row after that?
I've had success now creating the new record based on the first row, but where I'm stumped is looping through to the following rows until all rows have been done.
1 of 1 people found this helpful
When you use "go to related records", you are no longer in a portal, you are on a layout of table records based on what was in the portal from the original layout. Thus when you go to Table C and create a new record, and return to Table B's layout, you just need to use the "go to record next / exist after last" before "end loop" to go to the next record in your "filters needed" layout.
Also on a technical note, there is a "go to portal row" script step that will take first, last or by number into account. But I wouldn't see you using it in this case.
I'm pretty sure I've been thinking about this wrong in a couple aspects. I think I'm headed in the right direction finally. You've been very helpful and I really appreciate it. I'm going to hit this hard tonight and post an update soon.
I was able to make it work Mike. Your initial scrpt step suggestions got me on the right track. I just had to get my head around it and tailor it to my specific situation. Thanks so much!
And now you've gained those skills to use for next time! Glad you were able to figure it out.