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

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

Recommended Posts

Posted

I have a very simple script that runs fine when run from the client side but when run as a server side script it gives unexpected results. All the script does is set a field (on the database where the script originates) to a date on a related database on the same server, getting the latest date by using the Max function:

Set Field Sales::latestInvDate; Case(

Sales::LinkedTo = "SF"; Max ( Invoice::Invoice Date );

Sales::LinkedTo = "LA"; Max ( Invoice_LA::Invoice Date );

Sales::LinkedTo = "CO"; Max ( Invoice_Colo::Invoice Date );

"" )]

Running on the server side gives an empty result but on the client side I get the latest invoice date. The log shows that the script runs without errors. Thanks.

Posted

As you sure that you are in Sales when this script runs. Remember, you need to be in the correct context. How about disabling your Set Field and add a simple Set Field Sales::lastestInvDate, "12/21/09" and see if that works. If it does, then it's the case statement. Since your TOs aren't named in a way that I can tell if they are related to Sales, it's hard to troubleshoot your script. How can I get Max (Invoice::Invoice Date), if there is no relationship between Sales and Invoices?

Posted

Yes I'm sure I'm in sales when it runs. It runs fine when triggered on the client side but not on the server side. A test, without a lookup across a relationship, setting a field in the Sales database works fine. It seems to be the relationship that is not supported on the server side. Are server side scripts limited to working with data that is only local to the same database that the script is run from?

Posted

Just some thoughts ...

Do any of your referenced relationships rely on global values? If so, it may play a part in the behavior/problem. From the context of the Server, are you establishing those globals?

Alternatively, are you able to "read" or get anything through these relationships, in the context of a server-side script? For example, are you able to get the value of the first related record through your "Invoice::Invoice Date" relationship? If no, then the problem occurs before adding in the Max function.

Maybe these will help.

Posted

Are server side scripts limited to working with data that is only local to the same database that the script is run from?

If the script is fired from server, yes. And no, it doesn't make sense ... we often times have two FM servers running with data on both and the fact that server-side scripting can't set a field served elsewhere is weak and (well, I could say more but I won't).

Posted

Wait ... I believe I misunderstood. The second file is being served in same data folder by FMS? If so, it should work. It is when the other file is served elsewhere that Set Field[] will break (with server-side scripts).

Posted

the Set Field[] is setting a field local to where the script is run from but the relationships that the data is being pulled from is on the same server but in different data folders. There are 3 different data folders, done purely for organizational purposes.

Posted

the Set Field[] is setting a field local to where the script is run from but the relationships that the data is being pulled from is on the same server but in different data folders.

Therein lies the rub so my first thought was probably correct. I've had similar issues (but not with different folders under your /data folder) so I tested it two ways:

I created a file called SetField and placed it in a new folder under /data called /data2 and opened it in Admin. I then created a file reference to file Test which resides in /data and created two scripts in SetField file hosted in /data2:

Script 1 has allow creation on to Test and it sets a text field in Test. It works if ran by Client. It fails if ran by Server-side script and produces error 100 (file missing).

Script 2 sets a field in SetField but pulls the information from Test. It sets the field properly if ran by Client but fails by Server-side script and no error is produced in the log.

Posted

Thanks LaRetta. I'm getting the exact results as you do in your Script2. At this point server side scripting is useless to me. Maybe a fix in Filemaker 11...sometime next year...

This topic is 5449 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.