Jump to content
Salesforce and other SMB Solutions are coming soon. ×

creating a new field from data in portal fields


ehope1

Recommended Posts

I have two tables, invoice and lineitem. The line item table is a portal in the invoice layout and has a field called Breed. I need the breed info by line item but I also want to create a separate field on the invoice layout that basically copies all of the different breeds that a customer orders into one field (to be later exported for another purpose). I've tried doing it with a script and looping but I guess I'm too inexperienced at scripting to get it to work. Can anyone offer suggestions please?

Link to comment
Share on other sites

This is what I have but it doesn't work. Any suggestions?

 

Refresh Window []

Go to Layoun[“Invoicing”(Invoicing)]

Sort Records[Restore;No dialog]

Loop

Go to Portal Row[select;First]

Go to Field[LineItem::Breed

If[LineItem::Breed > “ “]

Copy[select;LineItem::Breed]

Paste[select;LineItem::Breed]

Go to Portal Row [Next; Exit after last]

End If

End Loop

Go to Record/Request/Page[Next]

Exit Script

Link to comment
Share on other sites

Your script is copying/pasting the field to itself. In the Paste step you want to specify into which field the copied data should be pasted, not the field from which you copied it. Using Set Field would be more efficient here, but you don't actually need a script at all. Just create a value list based on the related Breed field and an unstored text calculation in the Invoicing table of

 

Substitute( ValueListItems( Get(FileName); "BreedValueList" ); ¶; ", " )

 

This will return a comma-delimited list of related breeds.

Link to comment
Share on other sites

Thank you for responding! I tried what you suggested with Substitute( ValueListItems( Get(FileName); "BreedList" ); ¶; ", " ) and it is very close to what I'm trying to do. It gave me a list on every record of all of the breeds that had been ordered on all records. I want a list on each invoice of only those ordered on that invoice. So if customer A orders Akita, Pug and Poodle items, then the breedlist on his record is Akita,Pug,Poodle....whereas if customer B orders Dachshund, Airedale and Beagle, then the breedlist on his record is Dachshund,Airedale,Beagle. Right now I'm getting Akita,Pug,Poodle,Dachshund,Airedale,Beagle on every record.

Thank you again for any help you can give me.

Link to comment
Share on other sites

  • 4 weeks later...

Hello All,

I have a similar situation, almost exactly the same, except I cannot use the ValueList trick because there may be repeating values (the content of the field might be: aaa, bbb, ccc, aaa, ccc and so on).

Does anyone have another idea?

 

I have a script (too big to include in its totality) that uses the following, in a loop, the loop repeats the operation for the number of portal rows, as well as for the number of records (I can post the full script if anyone is curious).

The problem with that script is that it is very (very very) slow, and as such, not usable on the final product.

 

Any help would be appreciated...

Thank you,

philo

 

 

Go to Field [ MasterItemContents::EpisodeID ]

Go to Portal Row

[ Select; First ]

Go to Field [ MasterItemContents::EpisodeID ]

[ Select/perform ]

Copy [ ]

[ Select ]

Paste [ MasterItems::EpisodesList ]

[ Select; No style ]

Commit Records/Requests

[ Skip data entry validation; No dialog ]

Insert Calculated Result [ MasterItems::EpisodesList; "; " ]

Link to comment
Share on other sites

I think you can speed up matters if you create a found set using Go To Related Records. If I understand correctly, you script jumps to and fro from the master to the related records, that would explain the slowness.

 

 

 

Code:


go to related records[show only related, "relationship_name"]

#you are now in the related table/file#

perform script[external["your_loop_script"]

commit record/request

refresh window


 

You do need to adapt your loop script to perform from within the related table.

I'm not quite sure what you are trying to achieve with all the copy/paste action. You can use set field[ ] to do that.

 

If you need further assistance, please post again, but please try to be as specific as possible. You can post a sample with your script if you like (zip the .fp5 or .fp7 file first)

 

kjoe

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use