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.

Is it possible to make variable in FM Pro 6 or 7?

Featured Replies

Hi everyone,

My company has developed a lot of FM DB to help different departments and the company. Now, we are facing a big problem.

The problem is I can't create variable. As a result, I need to create a same function of script to different users to achieve my company needs or objective.

For example:

I have 100 users and each user has 10 scripts, so total is 500 scripts. When the change is needed, it will be a huge job.

Does everybody can advice me a solution or plug-ins can improve our saturation? Also, does everyone know how to make a sorting in ScriptMaker inside? It will be a big help.

Thanks for your time.

Hi Timohy, and welcome to FM Forums. FM7 allows you to pass a parameter to a script, so in your situation you could write just ten scripts and the script will determine its behavior based on the user name you passed as a parameter. This alone is reason enough (to me) to move up to FM7 despite all its problems.

As for your last question (about ScriptMaker)--if you're asking whether you can sort scripts by name within ScriptMaker, then the answer is "No."

Does this help?

Jerry

"The problem is I can't create variable."

Do you understand how to use globals? This is one of their primary functions, to act as a variable holder. Also, you're not giving any examples of your scripts. It is very likely that you don't have to use the technique you have elected to use.

Bruce, in many instances in FM6 and earlier, a situation such a the one Timohy described was, indeed, necessary. A trivial example can illustrate this: I have a layout with three buttons. One is labeled "Apples," another is labeled "Bananas," and the third is labeled "Cherries." If i want to create a script that sends me to the layout of the same name when i click the button, i cannot do this in FM6--i need three separate scripts. (I know, i could eliminate the script and just set the button to "Go To Layout (layoutName)", but as i said, this is a trivial example.)

In FM7, you can do this with one script, because a button can pass a parameter to the script and that one script can use internal logic to determine which layout to go to. There is far greater usefulness to this feature than i've described here, and it may be that Timohy is in that type of situation. I was giving him the benefit of the doubt that he wasn't needlessly creating 1,000 scripts.

J

  • Author

Bruce, thank you for your advice and I know how to use Global variable.

Here is my typical example.

I've developed an internal message system. I hv over 150 users using this database in 5 countries and each user will hv 6 scripts, New, Read, Keep, Done, ToDo and Reply. All above scripts were displayed in one layout.

Thank you for your time

Hi Timohy, what is different about the scripts that makes it necessary to have different scripts for each user? Are you passing a user name, or is there actually some different procedure that happens when User1 calls the script that doesn't happen when User2 calls the script?

J

  • Author

Yes, the scripts are passing a user name and will modify different feilds but all the procedure are same.

Example.

1. New: Get user name from script then search feilds "UserName001-150" and "UserNameRead001-150" if it mark as "N"

2. Read: Mark feild "UserNameRead001-150" to "Y"

3. Keep: Mark feild "UserNameMark001-150" to "Y"

4. Done: Mark feild "UserNameMark001-150" and "UserNameToDo001-150" to "N"

5. Reply: Mark feild "UserNameToDo001-150" to "Y"

6. ToDo: Search feild "UserNameToDo001-150" if it mark as "Y"

Pls advice if you have better idea.

Thanks.

If i understand what you are trying to do, you might be better off creating a separate file called Users.fp5. Relate this file to your main file through UserName::(=UserName. Say you have five users; there will then be five records in Users.fp5, with the contents of UserName being User01, User02, User03, User04, User05. The Users.fp5 file also contains the fields "001-150", "Read001-150", which perform the same function as what you have identified as "UserName001-150" and "UserNameRead001-50".

Now, when you change the global UserName in your main file, you will have access to those fields for only the selected UserName. So in your script, you can just change the contents of Main::UserName to the appropriate user's name, and modify the field Users::001-150 and Users::Read001-150 as needed.

I may be off base, but it looks as if this is what you are getting at. Feel free to attach a clone of your files if you think i have the wrong idea.

J

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.