Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4635 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I've seen similar questions relating to coping portal rows, first, last etc. But I would like to copy the entire contents of a portal, all rows. Here's the scenario as it relates to three of my tables: I use a contacts, tasks and projects table (FM pro 10A) I have a layout (workorders) in my projects table which allows us to create work orders specific to work our clients request. Work orders are a combination of the client information, the project requested and a list of task that that project requires.

We have a great deal of duplicated work, example 20 clients may all want the same service during the same month. So to make creating those 20 work orders easier I have written a script (copy last project) where i manually create a new work work order ( ie client bob smith wants a project consisting of 4 tasks completed this week) then execute the script (copy last project) ( because his neighbor John Jones, also a client, wants the same work) this script lets me select the new client (john jones) from our client table then duplicates all the fields from the previous work order (bob smith's) onto the new work order for John jones. The problem is only the first row in the tasks portal will copy. I don't want to jump back and forth using a "copy next row" type loop because I know that's flawed with problems.

I named the portal "project tasks" and I think I should be looking at a "go to object" line in the script IE go to object [portal "project_tasks"] but how do I copy the entire contents of the portal then paste it in the new work order? Or is there another solution I should explore?

I guess I should mention my portal is 1-12 rows and not all rows are used all the time as in bob smiths and john jones work orders there will be only 4 rows of tasks

Posted

Have you tried setting a variable with the ID of the new person (for the new work order) then from the portal, via a button, going to show only these related portal records (on their table layout)?

On this layout a simple looping script can duplicate each of the "found" records and enter the new foreign key (the variable) into each record.

Posted

the [copy last project] script reads like this right now

go to record/request/page [last]

perform script["go to contact picker" from file:"contacts"]

duplicate record/request

select window[current window]

goto layout ["form view- projects" (projects)]

set field [projects::contact ID; contacts::temp data]

goto record/request/page[previous]

copy[tasks project ID::task name]

goto record/request/page [next]

paste[tasks project ID::description]

insert from last visited [ tasks project ID::description] [select]

this allows me to run the contact picker script form within the copy script. The contact picker script essentially displays a table from the contacts table of all "active" clients from which we select the desired client assigns that client ID to a new project record with a unique ID, workorder_# (along with location and other info) then copies other work order layout information (date, week number, location, etc. It copies the portal which contains tasks from a pull down menu, but only the first line. I need it to copy from 1-12 lines depending on the tasks assigned to that project. I hesitate to use a looping copy type solution because I believe its flawed in concept. If I use a script from within the portal wont I lose all the other information that is being copied over to the new work order?

I know this script is rudimentary but it is functioning as I need it to EXCEPT the portal rows.

an improved version is welcome as long as we get all the rows of the portal

Posted

I would avoid using "Copy". It is better to transfer values by using variables. I'm not sure that I understand your script and exactly what you are doing but if you only want to transfer values from a variable number of related records in a portal you could use a counter as in the below pseudo code script

Set Variable $counter; Value:1

goto object - select correct portal

Go to Portal Row [ $counter ]

Use variables and set each of these with items to be duplicated from portal

Increment the counter for selecting next portal row for next loop [ $counter; Value:$counter + 1 ]

Go to Layout of related records

New Record/Request

Set Fields with the variables

Go to original Layout

check for only 1 row in portal

If count of relatedrecords = 1

Exit Script

End If

repeat process for subsequent rows

Loop

goto object - select correct portal

Go to Portal Row [ $counter ]

set variables again including $counter; Value:$counter + 1

Go to Layout of related records

New Record/Request

Set Fields with the variables

Go to original Layout

stop process when all rows done

Exit Loop If $counter = total of related records + 1

End Loop

Go to original Layout

Refresh window

Posted

I get your variable counter suggestion. regarding the portal and rows. I dont have the time to try it now but I will soon.

Sorry my script isn't very good. I'm still a novice. What it does is goes to the last record (the last project created) then it runs the script contact picker which allows me to create a new project (new sequential project # & new client (puts their info into the new project) jumps back and copies the last record and pastes that info into the new project. It jumps back and forth a few times between the new project and the last project, to copy all the info, which I know is bad methodology but I'm just a simple guy. like I said the only problem is I can only get the first row of the portal which contains the project tasks. I think adding your looping will help me pick up the next "X" rows til blank.

I know copy is a bad idea but I'm not sure I'm using variable correctly either.

My goal is to be able to create a project (or find a project I want duplicated) then copy it into a new project containing all the same info except for the client info (name address) which is taken care of by embedding contact picker.

I can provide more details about my tables etc if you would like. I know there are probably many area that could be improved.

Thanks

This topic is 4635 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.