GUI and Events issues

HI,

All the following is from a Mac OS v11.7.10

1- The UPLOAD DOCUMENT button is wrong (see picture).

2- The dollar sign is full black instead of grey like everything else (see picture).

3- All dates that I select get subtracted of one day when saved (see picture).

4- One more thing, function doesn’t get launched on the Event “On Validate” on a field of a form. “Five Inspector” show nothing. Why?

5- Same problem with Event “On Drill Down” on the menus.

Thank you.

Hi f.i.Sciences,

Points 1 and 2. Thanks for bringin this to our attention, I’ll pass these onto our QA team.

Point 3. I can see that your display type is Date, however, is your data type TimeStamp? If it is it is getting the UTC time, hence, a day behind.

Points 4 and 5. Your code should be executed if you want to see it in the Logs page you will need to use five.log(). If you click the Execute Tree tab and then the Function Variables tab and the Execution Log tab you will see they have been executed.

I hope this helps.

Hi Jo-Anne,

1 & 2 - You’re welcome.

3- All dates are Date type and use _Date display type. I soon as I save the form and switch to another record and back to the new one, the date get -1 (see picture).


Maybe it has something to do with daylight saving time. I’m in a country that does not use it, but my real country does it. We are in the same time zone from north to south of each other. In the night of 9 to 10 March, my country changed the time back with the country I’m currently in. Sometime I use a VPN, but for this test I wasn’t connected. Hope this will help!

4- Added log() code, but it is definitely not executed. Even if no log() was there, Execution Tree should have it in it.

Thank you.

Hi f.i.SCIENCES,

Point 3. I have escalated this to our QA team due to it being date fields to see if they can reproduce it and work out what is going on here.

Point 4. The On Validate and On Drill Down events are being executed for us here, is it possible to see your code or fdf? I’m happy to contact you privately through email so you do not need to attach anything on the forum. Could you also try debugging in the console and see if it executes, don’t forget to change five.log() to console.log()

Yes please, send me an email for the FDF.

Thank you.

I have sent you an email f.i.SCIENCES that you can respond with your FDF, thank you.

Hi f.i.SCIENCES,

I can see that the On Validate is not executing for your Date field on the Reunions form, this is because currently the date picker validates the format for us, however, we will look at adding an On Validate event to a date/time based field.

If you move the On Validate to the On Enter on the Lieu field you will see it execute if you put a five.log() in the first line of your code block. If you go to the field in your form Adresses:General:CodePostal you will see here that your code is executed in the Execution Tree. If you want to see a log here just add in five.log()

I noticed a couple of other things while I was in there. Your ProchaineReunion function is using executeQuery(). This won’t work in the frontend, it is purely a backend function as it is interacting with the database. It cannot be used on an ‘On’ event. Tip: On events execute in the browser, Do events execute on the server.

To achieve what you are trying to do you could create two functions, one would use executeQuery() in the backend and the other function would be a frontend function that calls the backend function using executeFunction()

There is a good example of this is in the Portfolio learning resource.

The On Drill Down event executes when drilling down from a parent menu. A parent menu must reference a form to have the ‘Down’ button available in the app bar. Use this link to see how to set up a parent menu.

I hope this helps, thanks for sending the FDF makes it a lot easier to help!

Hi Jo-Anne,

Thank you for your helpful reply.
Three questions:

1- How do we return values from the server (BackEnd) to the client (FrontEnd)?
There is no “how to/explanation” on the pages you provide, neither on the documentation.

2- Does the FDF include code and data when exporting (everything included)?

3- Can I select the first record automatically when showing a form? Because it’s a configuration table with only one record in it.

Thank you.

Hi f.i.SCIENCES,

UIServerDataTF.fdf (2.9 MB)

I have attached an fdf, download and import this. I’ll show you how it works in the app first. Click the Run button. In Field1 type something and press tab, you will receive a message from the UI.

Click the OK button in the message and you will see data returned from the server in the EmptyField.

If you look inside of Five you will see two functions: UIFunction and ServerFunction.

Have a look at the UI Function first and then the ServerFunction. You will see they are heavily commented so you can understand what is happening.

The UIFunction is attached to the On Exit field for Field1, so I’m sure you know this, this obviously gets executed when exiting the field!

Point 2. When you export into an FDF file everything is exported with the app, all your code, data and schema.

Point 3. Yes you do this through permissions. I have also set this up in the sample app for you.

Note: For this to work you must have one record saved in your application before you remove create and delete permissions to the table, by default all permissions are applied to the table.

  1. Go to the Roles view under the Setup menu.

  2. Select the standalone record and click the Permissions tab.

  1. Select the Configuration record. You can see here that I have only applied read and update permissions.

  1. Run the app and you will see the record is preselected without a list next to it.

I hope this helps!

1 Like

Thank you Jo-Anne,

The only issue I had is that the Event “On Exit” doesn’t seem to work either (like On Validate you previously told me).

Also, how do we play with dates here? Is the Date object in Five returned by the executeQuery() or a field the same as in JS?
I want to add days to it to get a new date for next meeting.


Log: ProchaineReunion() code executed! 18;2024-03-19;14

A+

Hi f.i.SCIENCES,

DateTest.fdf (2.9 MB)

Regarding setting the date in the callback to the field you just need to use the toISOString() function on the js Date object as you will see in the example FDF.

I have attached an FDF that explains this for you. If you go to the Functions view and open the code editor for the CalculateOtherDates function, you will see how we do this Five. The code is commented for you. This is then attached to the On Exit event on the Name field on the Dates form.

Run the app, and you will see the Today field is already populated with today’s date, you can do this by using the now() function on the Five object in the Default Value field. In Five, go the Today field and you will see this.

Type something in the Name field, press tab:

  • The Tomorrows field will be populated with the current date + 1.
  • The Seven Days field will be populated with the tomorrow’s date + 6 and converted to a string.

All of our date and time functions are ISO string based, therefore, any dateTime package that parses ISO based date strings can be used with Five.

I hope this helps and here are some links to our internal date functions that could be helpful to you.

date() | Five | Low-Code For Real Developers

dateTime() | Five | Low-Code For Real Developers

dateTimeLocalToUTC() | Five | Low-Code For Real Developers

dateTimeUTCToLocal() | Five | Low-Code For Real Developers

now() | Five | Low-Code For Real Developers

time() | Five | Low-Code For Real Developers

Hi f.i.SCIENCES,

We investigated your issue with the wrong date being shown and found the problem, it has now been fixed and will be in our next release. Thanks for bringing this to our attention.

Hello Jo-Anne,

This is what I get when I run your demo.

Thank you.

Sorry f.i.SCIENCES, that was my fault. Please import this FDF over the top of the current one. It has been fixed, 2 small issues, the default for the Today field should of been five.date() not five.now() reason is the field is a date field not a timestamp. And in the function, when assigning the value from the ISO string we need to separate and use the date part.

Sorry for the inconvenience, I didn’t test saving it!

Hi Jo-Anne,

Where is the FDF?

Thank you.

DateTest.fdf (2.9 MB)

Here you go!

Hi Jo-Anne,

Doesn’t work in my project ;-(
I’ll send it to you again.

Also, it’s hook to the Lien field, but I need it to be hooked to the Date field.
When Date Events are gonna be fixed?

Thank you.

Hi f.i.SCIENCES,

I have looked at your FDF and emailed the code that you need to use as your use case was a bit different as you were using a callback.

Our QA team is currently investigating this, I will keep you updated.