Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How to emulate better programming languages?


This topic is 7350 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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

Posted

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.

Posted

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?).

Posted

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.

Posted

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.

This topic is 7350 days old. Please don't post here. Open a new topic instead.

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.