Jump to content

Copying text from portal and new record/pasting to another table


Matthew R White

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

Recommended Posts

I have a portal in my main database that displays records from the table (TDL) with a date and text field.

 

I'm trying to write a script that copies the customer number from the main database, goes to the PLD table, creates new record, pastes the customer number (this is the key field in which my database is kept together) then goes back to the portal row from TDL, copies the text field, goes back to the PLD table and new record just created and pastes the text data into the text field.

 

Currently my calc looks like this (see attached) but I'm not getting accurate copies.

 

  

1.tiff

Link to comment
Share on other sites

I think most people would advise against that approach of copy/paste.

Better would be to set each field as a separate variable, go to the proper layout, new record request, then use Set Field (twice).

Link to comment
Share on other sites

Can you explain the purpose of the second step here:

 

... then goes back to the portal row from TDL, copies the text field, goes back to the PLD table and new record just created and pastes the text data into the text field.

 

What exactly are you trying to accomplish here?

 

--

In general, you should use Set Variable[] and Set Field[] which work at the data level, instead of Copy, Paste or Insert Calculated Result that work at the layout level and will fail if the fields are not on the layout.

 

Note also that a script is not a "calc".

Link to comment
Share on other sites

The purpose of the second step is, once the new record is created in PLD and correctly linked with the customer number, to go back to the portal on the original layout and copy the text, and transfer it to the newly created record in the PLD table.

 

If I used set field... I would for example I would Set Variable (customer number) 

Then go to the PLD layout, create a new record and Set Field ($ variable) ?

 

I've attached a pic for more context.

The Suspense box is a portal to the TDL Table, the Activity box is the PLD Table. When I check the box in the suspense TDL table, I'd like it to disappear and transfer over to the PLD layout below

post-105196-0-48948000-1407876596_thumb.

Link to comment
Share on other sites

Why copy the data into the new record? This sounds like a relational design problem.

 

In general, the purpose of relational data systems is to NOT have duplicate copies of data.

 

There are some valid exceptions; such as when you want to capture data that is a "snapshot", where the original data may change.

Link to comment
Share on other sites

The purpose of the second step is, once the new record is created in PLD and correctly linked with the customer number, to go back to the portal on the original layout and copy the text, and transfer it to the newly created record in the PLD table.

 

Yes, but why is it necessary to copy the text from the first related record (?) to the new related record? If you have some data that needs to be pre-filled for each new record (until the user changes it), why don't you use the auto-enter options for the field?

Link to comment
Share on other sites

Its not pre-filled data, the copied text is data that is entered by the user and isn't automatically pre-filled


So in the Suspense box, if I create a new suspense record, and type in the text box - "Wait for Blue Elephant" then I go about my day, when the blue elephant arrived, I check the box next to "Wait for Blue Elephant" and that text is transferred to the Activity box (PLD table) as a new record that shows which tasks were completed. Until the tasks are completed they remain in the suspense box.

Does that make any sense?

Link to comment
Share on other sites

Does that make any sense?

 

Not really. If I understand this correctly (and that's a BIG IF), then there should be one record concerning the arrival of a blue elephant. That record should have a field showing if the task had already been completed (probably a date or a timestamp field, recording the date and/or time of completion). I cannot see why two records would be required for this.

 

Note that you can use portal filtering (or dedicated relationships) to show pending and completed tasks in two separate portals.

Link to comment
Share on other sites

It does not sound necessary; as Comment says and as I have suggested. But the general business of avoiding copy/ paste and handling multiple chunks of information is something that you should know how to do.

It goes like this:

Set Variable[ $customerNum; customer::customer number]

Set Variable[ $comment; customer::comment]

Go to layout [ other layout]

New Record

Set Field[ PLD::customer number; $customerNum]

Set Field[ PLD::note ; $comment ]

Commit Record

  • Like 1
Link to comment
Share on other sites

This topic is 3568 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.