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.

How to emulate better programming languages?

Featured Replies

I'm trying to port a PHP/Mysql application to FM7.

I use a lot of PHP arrays but there's nothing like this in FM7. I'm thinking about using a dummy table to emulate the arrays.

Moreover, replacing the variables by hidden global fields seems also a solution.

Has any PHP developer already come up with a solution?

How about a C++ plugin?

a) plugin: there is, but I forgot where

B) you can emulate any type of array using a simple text field:

record1: a;b;[c;d;e;f];g;h <return>

record2: a;b;c;g;h <return>

simply use the text parsing features Left(), Middle(),Right() to parse the array values.

This can be done more easily with Custom Functions, see that forum or follow the link:

http://www.spf-15.com/fmExamples/ and look for Matrx Math

Return-delimited lists are also handy in v7, because of the new LeftValues() MiddleValues() and RightValues() functions ( and ValueCount() ). Also return-delimited lists pop up all the time in FM... like in value lists and in many of the design functions.

  • Author

OK, that's nice of you!

IS there a possibility of storing rows of FM tables instead of simple values in these lists?

There are 2 ways I can think of off hand. One involves some scripting. You go to a layout with only the SerialID; or whatever you want in your "array", then Copy All Records (script step). Then go to another (hidden) layout (of any table) and paste into a Text field, with Global storage. That gives you an unstored temporary tab-return-separated list of values. This could be from any set of records, the current Found set.

The 2nd way is to use the ValueListItems function. This will also give you a return-separated list of all the values in (your) defined Value List. The 2 "gotchas" are: 1. The name of the value list will usually be typed in, hence prone to typos and breakage if you change the name, and 2. The result must be Unstored to be dynamic and accurate.

Either of these could be set by a script into a Text field in a 1-record table, then it could be stored.

There is also a possibility, if you're on a Mac, to use AppleScript, with the Satimage Scripting Addition, which has all kinds of geeky math array stuff; I don't even know what B)-)

And last, there's the Troi Text plug-in, which lets you do more with lists, such as get an XOR result between two lists (maybe someone's Custom Function does this?).

One other thing to note about ValueListItems()... it only returns the unique values, not all the related values. If you want to return duplicate values, your value list has to be sorted by a secondary, unique field. If you want to sort by the values themselves, you can create a calc field that concatenates your field and the unique one and sort by that field.

I take issue with the adjective "better" in your post. Programming in C++, for instance, would take approx. 1000 times as long as programming in FM for the same project. Your boss or your client won't appreciate that. FM is designed for speedy programming and for beautiful layouts--which is what most people want.

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.