I think that Script Parameters use large amount of memory. If I start using extensively Script Parameters, will I crash or get into any such surprise? Pls anybody can advise me : )

I think that Script Parameters use large amount of memory. If I start using extensively Script Parameters, will I crash or get into any such surprise? Pls anybody can advise me : )

Thanks Wimdecorte for the prompt answer,

I think I was reading in an FM book (old could be ver 11) that using lots of variables at the same time and in loops, etc. can use up memory and cause FM to crash

So that is my concern, happy to know you had no probs using Script Parameters - do you have large complex calculations in your db? : )

I am not 100% sure but I think that a while back I was reading in one of the FM books (could be ver 11) that script parameters may use up large memory and cause a crash.

I use FM to calculate the Purchase of land and mortgage repayments, so I click run and it takes 5 minutes

The main concern is that once one field is populated, the second required to be populated and then the third, etc. and I may crash : )

If some of those smaller calculations can be "calculated once and stored" (by scripted Set Field), then the calculation(s) that need to call the smaller stored values will be faster. Only you can determine what can be set and stored. But I have found this to be significantly better in the long run over complex calculations.

beverly

- 1 person found this helpful
Hi,

aside from the current track of tuning up your calculations, I just wanted to point out a way that I use them to pass multiple parameters. Send your script a ¶-separated list. Then use:

$list = Get(ScriptParameter)

$var1 = GetValue($list; 1)

$var2 = GetValue($list; 2)

etc.

Hi Beverly, Thanks for your help, Yes I am using some Set Fields too. What I was looking for is some kind of refference to point out issues with using Script Variables and found it. This issue of the potential impact of over-use of variables on available application memory is addressed on page 339 of the FileMaker 10 Bible. So I will never use Script Variables (as at the moment my way of thinking is). Well unless there is something / anything that cannot be done with Global fields and can only be done with Script Parameters. Re the Speed issue, I created a Testing file to compare the use of Variables VS Global fields found them to take the same amount of time. The script was less then half a second and the variables also less then half a second. Thanks again for your help!

- 2 people found this helpful
JamesBind wrote:

What I was looking for is some kind of refference to point out issues with using Script Variables and found it. This issue of the potential impact of over-use of variables on available application memory is addressed on page 339 of the FileMaker 10 Bible. So I will never use Script Variables (as at the moment my way of thinking is).

I think that is entirely the wrong conclusion. There are no issues with script variables.

Hi Wimdecorte

Thanks for your help, can't post here the formulas as there are several calculations (5) and they all linked to each other. So the result of the first calculation is part of the second calculation and the result of the second is part of the third calculation and so on. So it is a bit complex but I found what I was looking for that there are some issues with Script Variables. As I am not overly familiar with SV I just avoid them and will have to do the old (and 'dirty') way using fields. Thanks again for the help!

Max(A;B;C;D;E) & "¶" &

If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) & "¶" &

If( GetAsNumber(A) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(B) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(A) and not IsEmpty(B) and Max(C;D;E) <= Min(A;B) ; Max(C;D;E);

If( GetAsNumber(A) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(C) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(A) and not IsEmpty(C) and Max(B;D;E) <= Min(A;C); Max(B;D;E);

If( GetAsNumber(A) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(D) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(A) and not IsEmpty(D) and Max(B;C;E) <= Min(A;D); Max(B;C;E);

If( GetAsNumber(A) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(E) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(A) and not IsEmpty(E) and Max(B;C;D) <= Min(A;E); Max(B;C;D);

If( GetAsNumber(B) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(C) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(B) and not IsEmpty(C) and Max(A;D;E) <= Min(B;C); Max(A;D;E);

If( GetAsNumber(B) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(D) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(B) and not IsEmpty(D) and Max(A;C;E) <= Min(B;D); Max(A;C;E);

If( GetAsNumber(B) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(E) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(B) and not IsEmpty(E) and Max(A;C;D) <= Min(B;E); Max(A;C;D);

If( GetAsNumber(C) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(D) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(C) and not IsEmpty(D) and Max(A;B;E) <= Min(C;D); Max(A;B;E);

If( GetAsNumber(C) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(E) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(C) and not IsEmpty(E) and Max(A;B;D) <= Min(C;E); Max(A;B;D);

If( GetAsNumber(D) >= If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and GetAsNumber(E) >=If( GetAsNumber(A) = Max(A;B;C;D;E) and not IsEmpty(A); Max(B;C;D;E); If( GetAsNumber(B) = Max(A;B;C;D;E) and not IsEmpty(B); Max(A;C;D;E); If( GetAsNumber(C) = Max(A;B;C;D;E) and not IsEmpty(C); Max(A;B;D;E); If( GetAsNumber(D) = Max(A;B;C;D;E) and not IsEmpty(D); Max(A;B;C;E); If( GetAsNumber(E) = Max(A;B;C;D;E) and not IsEmpty(E); Max(A;B;C;D);""))))) and not IsEmpty(D) and not IsEmpty(E) and Max(A;B;C) <= Min(D;E); Max(A;B;C); "")))))))))) & "¶" &

If(Length(Right( GetAsNumber(A); 1)) + Length(Right( GetAsNumber(B); 1)) + Length(Right( GetAsNumber(C); 1)) + Length(Right( GetAsNumber(D); 1)) + Length(Right( GetAsNumber(E); 1)) = 5 ;(If( GetAsNumber(A) = Min(A;B;C;D;E) and not IsEmpty(A); Min(B;C;D;E); If( GetAsNumber(B) = Min(A;B;C;D;E) and not IsEmpty(B); Min(A;C;D;E); If( GetAsNumber(C) = Min(A;B;C;D;E) and not IsEmpty(C); Min(A;B;D;E); If( GetAsNumber(D) = Min(A;B;C;D;E) and not IsEmpty(D); Min(A;B;C;E); If( GetAsNumber(E) = Min(A;B;C;D;E) and not IsEmpty(E); Min(A;B;C;D);""))))));If(Length(Right( GetAsNumber(A); 1)) + Length(Right( GetAsNumber(B); 1)) + Length(Right( GetAsNumber(C); 1)) + Length(Right( GetAsNumber(D); 1)) + Length(Right( GetAsNumber(E); 1)) = 4; Min(A;B;C;D;E); "")) & "¶" &

If( not IsEmpty(A) and not IsEmpty(B) and not IsEmpty(C) and not IsEmpty(D) and not IsEmpty(E) ; Min(A;B;C;D;E); "")- 1 person found this helpful
JamesBind wrote:

Hi David, Thanks for the help, very clever idea but I won't be using Script Variables as 1. They not much if at all faster (I was told they can't be indexed)

I truly believe you are on the wrong thought-path here with this.

Using variables has nothing to do with speed or indexing. Same applies to global fields.

Using variables is all about storing and passing temporary bits of data so that your workflow can access them, and taking advantage of the automatic cleanup of those.

(All Variables Should Be Global... Or Not. - Soliant Consulting )

Using variables will NOT make your machine run out of memory and will NOT crash FM.

Using variables CAN speed up your solution if you are invoking the database engine to read/write where you could just use a variable instead until you are ready to write the final value.

... actually it allowed me to paste it... so here we go, this is the first formula out of the 5..... it sorts 5 number fields into one field so biggest number comes first (on the top) smallest at the end and so on, you can Copy / Past it into a project with fields A, B, etc. and use it if you like : )

- 2 people found this helpful
What you need is a custom function to do the sorting for you... something like this: FileMaker Custom Function:SortValues2

but there are many others out there.

Thanks Beverly, First I (myself) need to learn how to use the built in sort that allows to sort 5 different fields and to combine those into one field (output) before I can teach them. I did the sort thing with portals but it didn't print out nicely so they wanted to have all in the one field... never mind from next week I am having a new client with more reasonable requests : )

The issue has nothing to do with the field names, although now you have fields named simply A, B, C, D and E you have a further problem—trying to remember what kind of data those fields hold; descriptive names are much better.

If you analyse your calc you will find you are making a zillion calls on the database—I tried counting the number of calls on field E and got to 150 before I lost my place, and I wasn't even half way down. If you are expecting FM to refer back to the database hundreds of times per field for five fields, then of course it will take a long time to process, particularly as the calls are dependent on other calls.

At the very least you should set the calc up as a Let ( ) function. This allows you to make a single call on the database for the value each field contains at the head of the function, and then refer to those values rather than going back out to the database time and time again. For example, if field E contains the value 25 and field D contains the value 36, it is obviously much easier for FM to process 25 and 36 each time you need it to than to have to go out to the database and look up the fields each time. Even if you did nothing else to refine the calc, you should at least do this much.

Hi,

I'm going to shoot another arrow at this target. On almost a separate topic, I wanted to point out some ways to clean up your calculations using Let and Case. Also, it looks like your fields are numbers, so you shouldn't need GetAsNumber. And, I would use "A > 0" instead of "not IsEmpty(A)". Here's what I did with just the second value in the calculation you presented. I believe that the before and after are logically equivalent ...

*Edit:*I made the assumption that your values were non-negative.

Thanks David, The reason I am using not empty (instead of zero) - if there is only 2 numbers to compare, say -6 and 3 then I get: 3,0,0,0,-6 instead of to get 3,-6 so looks like the empty gets a higher value then the zero when sorted and takes the place of the zero and I use the get as number incase it is a text / number combo and thanks for help and input : )

Thanks wimdecorte pointing out the function sorting values, unfortunately I couldn't get it to work, it has three (3) parameters require sorting while I have to sort five (5) so using the MinValue() and MaxValue() - doesn't look to me to sort all the five values

SortValues ( "apple¶grape¶banana" ; True ) --> "apple¶banana¶grape"

SortValues ( "apple¶grape¶banana" ; False ) --> "grape¶banana¶apple"

but thanks again for your help!

Don't give up so easily

That's not 3 parameters for that custom function; that first parameter is nothing but a list and it is not limited to 3 elements; it could be as many as you want.

Just feed it the equivalent of List( A ; B ;C ; D ; E ) of your example so that the call looks like

SortValues( List( A ; B ;C ; D ; E ) ; True )

Just want to thank everybody helped me and provided information regarding script parameters and how to use those parameters.

Looks like it is a situation that somebody mentioned something (that there could be potential impact of over-use of variables on available application memory on page 339) - and now it is hard to substantiate that script parameters will never crash the FM. But anyway thanks allot for all involved, next week I have a new client and won't need complex formulas of any kind so that is cool : )

- 2 people found this helpful
JamesBind wrote:

it is hard to substantiate that script parameters will never crash the FM.

As long as you keep saying it I will keep debunking it because I do not want people who find this thread to have the same reflex as you have (to not use variables).

FM has evolved a lot since FM10, and I've never heard of FM crashing because of using variables ever since they were introduced in FM8.

And since FM15, FM is fully 64-bit on both platforms so it can use even more memory if available.

So there is no reason to avoid variables. I would dare say that these days; a solution that is written to not use variables is going to be considered suboptimal.

To add to what wimdecorte says...I've NEVER seen a script parameter or variable crash FM. I use both a ton. But unless you are putting a GB worth of data in them or you have thousands of variables, it doesn't matter. It's just text. Text is tiny.

Storing temp data in a variable or passing via script parameters is faster than setting them to a global field. It's nominal, but it is faster in variables.

- 2 people found this helpful
Here is the only case (I know of) where a script parameter could cause some issues.

It is possible to pass container fields as a script parameter, container fields can be very large (Technical Specifications for FileMaker Pro 15 | FileMaker )

By the time you pass a few container fields as a list in one script parameter that are a few gigabytes each then you may go past the available RAM of the machine... 64 bit architectures should simply start using your other storage like HDD as the RAM and the application will just slow down, 32 bit architectures are more limited.

If you need more information about application memory limits are then here is one resource (for Windows) Memory Limits for Windows and Windows Server Releases (Windows)

Large amounts of data may be passed as a parameter if you pass in a rather large list of large text fields as a parameter to a script.

This also applies to setting large amounts of data to variables as well as script parameters.

In reality these situations aren't going to happen unless you try to make it happen. I use variables and parameters all the time as it makes the scripts more readable, repeatable and faster.

- 2 people found this helpful
JamesBind wrote:

so now what I understand it that FM evolved since Ver 10 and now it will not cause issues.

No, it never caused issues - except perhaps in some specific edge cases as CarlSchwarz indicated above, and how FM evolved took care of those too.

Thanks Carl, So if I convert the app to a Stand Alone Binded Solution before delivering it to my client, then this has noting to do with speed, reliability, etc. - is that correct?

This "File Cache" has noting to do with the total allocated or used Memory by FM? Is that right? What that means is that FM can use all my 4 GB of memory? correct?

Thanks in advance : )

- 1 person found this helpful
JamesBind wrote:

Thanks Carl, So if I convert the app to a Stand Alone Binded Solution before delivering it to my client, then this has noting to do with speed, reliability, etc. - is that correct?

This "File Cache" has noting to do with the total allocated or used Memory by FM? Is that right? What that means is that FM can use all my 4 GB of memory? correct?

Thanks in advance : )

Cache has nothing to do with reliability and everything with speed.

Cache also has very little to do with how much memory FM is going to use overall. It has a small effect of course but it is marginal.

FM is not going to use all 4GB of your available memory; the OS and other applications need to have their share.

One could argue that there is very little benefit in having a 64bit OS and application if you only have 4GB of RAM installed. It's a bit of an oversimplification but the whole point of using 64bit is that it can use more than 4GB of RAM (whereas 32bit systems can't).

- 2 people found this helpful
To add to the mountain of testimony that variables, even a lot of them, will not slow down or crash a solution: I've been working on a couple scripts this week that each routinely accepts parameters with tens of thousands of lines and sets more than 100,000 variables. Not only do they not crash, but the scripts run much faster than anything I could have done using fewer variables to achieve the same effect.

Use Script parameters, let, $, and create custom function if your calculation is longer than what you can see in the regular calculation window to your heart's content.

Avoid using many global variables $$, and avoid having big calculations in calc fields.

These pieces of advice should keep you out of trouble with memory.

- Let is a variable that dies at the end of the scope
- Script Parameter is just a way of executing a script with a parameter
- $ is a local variable to that script, can easily be used as a script parameter when triggering a sub script
- Custom Function is a name for your own calculation; and it takes more than 1 parameter, opposed to scripts
- $$ is a global variable that starts to live the moment you instantiate it, and never really dies, it's OK to keep 1 - 5, if you go beyond that you are entering a danger zone in my opinion, and I have seen people use them instead of script params and that's when the snow ball of more of them showing up never stops.

I put almost anything in the list. I've probably used a maximum of seven parameters at once. The main issue is commenting your code and using meaningful variable names so you know what's what within the parameter list. In this thread, you can read that you can pass containers as parameters - I never have. Oh, and of course, you can't pass values with a ¶ because they are the list delimiters - you'd have to substitute for that.

- 3 people found this helpful
The EasySync data syncing scripts use script parameters to pass data between a client and the server. On large record sets it is possible that the data exceeds the one million character maximum limit for script parameters. I have run into this situation and modified the code to split the data chunks into pieces that are less than one million characters.

Passing a script parameter in excess of one million characters did not crash FMP. The script step failed with an error, as you would expect. Repeatedly passing a script parameter of nearly one million characters does not crash FMP or FMP Go.

Jbante - thanks for comment, may I ask you pls, what OS do you use, how much Memory do you have, how do you set the Cash via the prefs - to what value? How long are you using this particular script already - one week only or more? Do you have it networked or stand alone? Also I am just wondering, why do you need so many 100,000 variables? - the largest FM solution I worked on had 'only' 4k fields so hard for me to imagine so many different variables to be required. Your help is most appreciated : )

because I cannot remember where and when they were set (especially the $$variables)?

mostly I use them and then dismiss them (clear), even if they don't last ($ within a script for example). It's old school declare, set & unset and I feel more "in control"...

beverly

http://www.soliantconsulting.com/blog/2014/02/all-variables-should-be-global-or-not

$$Variable used where another field need not be created in Manage Database? Where a field cannot be created in Manage Database (by permission), but a script can be created? (though I wouldn't allow script writing without full access...)

The article by wimdecorte may have some ideas.

beverly

ggt667 wrote:

What is a valid use case? I know it's there as a technical thing, but what is a valid best practice use case of $$?

variables have the reputation of being faster - so performance is one advantage. also $$vars can be used to cache data - as stated above the main difference and advantage is the underlying programming paradigm that you can alter their contents within calculations solely where fields can only be altered within script steps.

benefit of calculations is that their programming paradigm is functional and available everywhere within FM where calculations show. so for example you can even assign $$vars in conditional formatting or in field place holders etc.

(it is not possible to do this with global fields)

- 1 person found this helpful
Any use case that you want a variable that would remain static for the entire user session. Like a session ID or a token etc.

Seems like you would prefer global fields for that, and that is fine. They serve the same purpose.

But global fields require a field to exist, whereas global variables do not need a schema element. Global variables can be declared dynamically and use repetitions or not, use named buckets for their repetition index, etc.

Global fields can also have reps but only if they are defined ahead of time and are not as dynamic in their reps.

Like a lot of folks here, I tend to be extremely careful with the # of global variables and global fields since I have to manage their content explicitly, whereas calc variables and $ variables have a natural lifecycle with automatic 'garbage collection'.

You will be fine.

Why do you think using script params use 'large amount of memory'?

I have never known any FM solution that crashes because it runs out of memory for using script params. Hard to imagine any FM solution these days that does not use script params.