October 6, 200421 yr 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?
October 6, 200421 yr a) plugin: there is, but I forgot where 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
October 6, 200421 yr 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.
October 6, 200421 yr Author OK, that's nice of you! IS there a possibility of storing rows of FM tables instead of simple values in these lists?
October 6, 200421 yr 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 -) 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?).
October 8, 200421 yr 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.
October 8, 200421 yr 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