Jump to content

Recommended Posts

Posted (edited)

I have a Packing List function in my database where I generate packing lists for orders. I'd like to add functionality where I can either select an item from a dropdown menu then click a button and the item is appended to the notes field or where I can have buttons that I can click where text is input. As an example, if I have the following line items:

50 envelopes
100 envelopes
50 postcards
100 postcards
50 pens
100 pens

I'd like to be able to put the cursor in the notes field and click "50 envelopes" then click "50 postcards" then "50 pens" and the entry in the notes field would look like this:

50 envelopes
50 postcards
50 pens

The problem is that set field deletes the field contents each time so I only end up with one line item and I don't see how to make it append. If there were a paste function where I could define the text to paste that would do the trick, but I'm not seeing that.

Any suggestions? I'm sure there's a simple solution to this. I'd be grateful for any guidance

 

Edited by rcacciato
Posted
1 hour ago, rcacciato said:

how to make it append.

You cannot do this with a drop-down menu (at least not in the Notes field). You can do this with a button in a portal or list view of the line items that would set your Notes field to something like:

List ( YourTable::Notes ; LineItems::SomeField )

 

Posted

Thanks.

I don't want to have separate line items, just one field. I just want to be able to put the cursor in a field (notes), click a button, and have FM insert a text string. Is that possible? One suggestion I got was to have the script copy what's in the field into a variable, copy the variable and append the text, and paste. But that seems very cumbersome.

Posted
1 minute ago, rcacciato said:

I just want to be able to put the cursor in a field (notes), click a button, and have FM insert a text string. Is that possible?

It depends: where exactly would this button be?

 

Posted

Something like this. When I select an item from the dropdown and click the arrow, it pastes that text in the note field. Here's a screenshot.

 

Screenshot 2025-08-25 at 9.42.02 PM.png

I think I have a solution. I created 2 container fields set to global:

clipboard
clipboard2

This is the script:

Copy [ transmittals::notes ]

Paste [ transmittals::clipboard ] [ Select ]

Copy [ transmittals::packinglistitem ] [ Select ]

Paste [ transmittals::clipboard2 ] [ Select ]

Set Field [ transmittals::notes; transmittals::clipboard & ¶ & transmittals::clipboard2 ]

 

The dropdown has items in a value list where I define the possible items. Each time I add an item, I copy the entire contents of the notes field and paste it into clipboard. Then I copy the item selected from the dropdown and paste it into clipboard2. Then I set the notes field to the concatenated contents of clipboard and clipboard2. 

It works but I'm surprised there isn't a more straightforward way to do this.

Thanks.

Posted

A straightforward way to select multiple values is to create a record for each value as you select it. I thought you already had these selections as records, since you said:

9 hours ago, rcacciato said:

have the following line items:

I would also guess the value list your drop-down list is using is based on some records, so again I think it should be possible to choose those values from a portal or a list view, as suggested in my previous post.

Another straightforward way to select multiple values is to use a checkbox field. This could be done directly in your notes field, which you would then display formatted as an edit box in your final message.

Whichever method you choose, I would advise against using copy/paste, as it destroys the user's clipboard. Even if you insist on selecting the items one-by-one using a drop-down in a global field, it could be done much more simply:

AddToNotes.fmp12

Note that using this selection method it is too easy to select the same item more than once or add an item accidentally. The former can be prevented by using UniqueValues(), but removing an item from a list programmatically takes a bit more work.

 

Posted (edited)

Wow. This is a much more elegant solution. Thank you so much!

What I don't understand is this: when I look at the script step, you use set field yet that doesn't delete the contents of the note. Not sure how you did that.

Edited by rcacciato
Posted (edited)
48 minutes ago, rcacciato said:

This is a much more elegant solution

But is it a good one? I remain unconvinced.

 

48 minutes ago, rcacciato said:

you use set field yet that doesn't delete the contents of the note. Not sure how you did that.

The Set Field step overwrites the entire contents of the field. But the result is a calculation that combines the existing contents with the selected value - a sort of "read-before-write" operation.

 

Edited by comment
Posted

Well, it does the trick so I'm pleased. Thanks for your help!

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.