Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I am trying to write a simple script to copy a bill to address into a ship to address when they are the same. I found a script that does what I want using the set field command. I have tried to reproduce this same script using my database, but its not working properly. When I go to run the script, the data that i typed in to the bill to fields gets erased. I have attached a screen shot of the script. I am new to this so it might be something very simple that I am missing.

thanks in advance

Screenshot2010-09-24at93350AM.png

mhburris

I just did something like using copy and paste. I wrote a script to copy each Bill To field to the corresponding Ship To field, and then put a button on the layout that runs the script when needed. There may be a better way to do it, but this gets the job done.

It's hard for me to read your attachment, but it looks like it should work, unless you have reversed the fields.

The field to be set is the one that currently doesn't have the data, with the field that does have the data.

HTH

Lee

I can't really read it either but (zooming to max), I can tell that you aren't setting fields at all. If you had selected a field, it would look something like:

Set Field [ table::field ; "CF" ]

... instead you have:

Set Field [ "CM" , "CF" ] ... and I honestly don't know how you were able to exit the calculation dialog without an error. Anyway, since you aren't specifying a field, it is setting whatever field you are currently on (which is most likely the BillTo address).

Script ... Set Field ... check 'specify target field' and select your ShipTo field. Then click Calculation Result and point to your BillTo field. Nix the 'copy/paste'. Copy/paste requires that the field be on the layout AND it destroys the Users' clipboard contents. Use Set Field[] instead. :^)

I wasn't familiar with the Set Field method of doing this, so I did it the way that seemed easiest to me. I joined the forum so I could learn new ways of doing things, so thanks for the tip. I've also been reading all sorts of threads and picking up ideas, many of which are yours.

Having said that, if I'm the only user, and have to be on that particular layout where I enter data to determine if the Bill To and Ship To info is the same, is there anything wrong with using a copy and paste method, other than the fact it erases what's on the clipboard?

It's just a really bad practice to get into.

Also, it has the significant limitation that the fields must be on the layout. Using Set field does not require the fields to be on the layout.

Hi Ron,

It would be a bad habit to get into. Why not use Set Field[] which is designed for the purpose? Using copy/paste will cause you grief; trust me. Set Field[] is much more flexible (it can set fields in related tables, set fields not on the layout at all) and, as I said originally, the field must be on the layout for paste. One day you'll forget to place the field on the layout (or remove the field thinking you no longer need it) and you'll waste time trying to figure out why it didn't work.

But do as you wish ... sometimes we all do. And one day you will be surprised when you are working elsewhere in other programs and paste, only to find your Word document now full of 3,000 FM records instead of the graphic you expected. I've done the exact same thing. Then remember this thread. Knowledge is power; now you know. :smile2:

Okay. You convinced me. I wrote a script following your instructions and it worked the first time, so now I have a few others to rewrite. Always like to learn something new. Thanks.

  • Author

Yep had the fields backwards...thanks a ton!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.