Jump to content
Server Maintenance This Week. ×

Issue setting date in global field on server


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

Recommended Posts

Hi there,

 

I'm having a issue setting a global date field when performing script on server.

 

Here's some background:

 

I have a script that is passing a date field from a local instance of FMP to a script that is running on the server (need to run it on server for performance reasons)

 

The issue seems to come from the fact that the local system is set to dd/mm/yyy while the shared server we use is set to mm/dd/yyy - unfortunately we don't have access to the server admin.

 

To work around the issue I'm trying to convert the Local global date to a number (this is working fine)

Then passing the number as a script parameter to the server (this is also confirmed working)

the issue arises when I try and Set the global field as a date.

 

eg. Here are the script steps:


Set Variable [$StartDateParam ; Value:GetValue ( Get (Scriptparameter) ; 1 )
Set Field [Globals::zz__StartDate__gxd; GetAsDate ( $StartDateParam)]
Set Field [ProductSalesReport::Test ; Globals::zz__StartDate__gxd]

But I always get a ?

 

I have tried an number of different steps but it never works.

 

When I try the following:

Set Variable [$StartDateParam ; Value:GetValue ( Get (Scriptparameter) ; 1 )
Set Field [ProductSalesReport::Test ( $StartDateParam)]

I get the FMP date format eg 735630

 

I also tried:

Set Variable [$StartDateParam ; Value:GetValue ( Get (Scriptparameter) ; 1 )
Set Field [ProductSalesReport::Test; GetAsDate ( $StartDateParam)]

Which also resulted in ?

 

I've spent half a day on this so far, obviously missing something simple. Any Suggestions?

Link to comment
Share on other sites

So, you're passing in 735630? and you're getting 735630 on the server. 

 

What if you do an intermediate step :

Set Variable [date;Value: GetAsDate($startDateParam)

Do you get a ? result?

Link to comment
Share on other sites

Yes tried that also - admitedly the only way I can test it is to then save it to a field and check on the local machine but in that instance I also received ?

 

I have changed the database structure so that I'm no t relying on global fields for the date value and that has solved my issue.

 

The only way I got it to work was the reformat the date on the server using:

Date ( Middle ( $StartDateParam ; 4 ; 2 ) ; Middle ( $StartDateParam ; 1 ; 2 ) ; Right ( $StartDateParam ; 4 ) )

The issue with using this though is that IF something changes on the server ie. move the file to different server with a different date format the script would break. Hence the changes in database structure to avoid having to pass the globals through the script.

Link to comment
Share on other sites

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