Some questions and problems (1/2)

Good morning,

1- The doc is not completed, I know it’s hard and boring to do. But where can I find how to use the « Custom Display Types » for phone numbers and postal code (“418 808-4839” and “G6J 0P3”)?

2- I have added a field _Combo to a many-to-many relationship table and to its form. But when I try to change and save the value, I get this error.

Error : ErrDatabaseError

Message : Could not map formfield 'ReunionsKey' to table 'MembresReunions'. Got 0 formfields instead of 1

System Error :

Trace : integrityManager.go:634 five.co/data/dbintegrity.(*IntegrityManager).verifyRecord << integrityManager.go:293 five.co/data/dbintegrity.(*IntegrityManager).processVerifyRecord << integrityManager.go:240 five.co/data/dbintegrity.(*IntegrityManager).processCommand << integrityManager.go:255 five.co/data/dbintegrity.(*IntegrityManager).Start.func1 << asm_amd64.s:1599 runtime.goexit <<

Query: mutation ProcessTransactions($selectionKey100: String!, $actionKey100: String!, $parentSelectionKey100: String, $keys100: [String]!, $versionKey100: String!, $fieldUpgradeData100: String, $fieldNames100: [String], $values100: [String]) { update100:dbapiFormDataSave( selectionKey: $selectionKey100, actionKey: $actionKey100, parentSelectionKey: $parentSelectionKey100, keys: $keys100, versionKey: $versionKey100, fieldUpgradeData: $fieldUpgradeData100, fieldNames: $fieldNames100, values: $values100) { entityUpdate{ keys versionKey versionsExist permissions values { name value type } } } }

Variables: {"selectionKey100":"0d0321ca-d46d-4657-b960-5462a53539e4","actionKey100":"0002f0d5-a005-4b19-95c6-ab983aef1bcc","parentSelectionKey100":"","keys100":["78bbb4ff-44d0-4ebb-b22c-e1e6b97c08bd"],"versionKey100":"ac8c0a8c-dbc8-11ee-8756-46716299da7a","fieldNames100":["MembresReunions.MembresReunionsKey","ReunionKey","MembreKey","Participation","ReunionsKey"],"values100":["78bbb4ff-44d0-4ebb-b22c-e1e6b97c08bd","3cc555b4-e7be-4282-9435-7b5b28815056","cd415751-d0e3-4577-82a6-29334ca2ffcb","1","3cc555b4-e7be-4282-9435-7b5b28815056"],"fieldUpgradeData100":""}

3- How do I add another field data to the top description of a form? i.e. for a user table, when I select one in the list, only its first name is written on the top of its details.

4- When I add a record in a list and I forgot to put value for a field that is needed, I get an error (it is fine). If I delete the record and try to save again, the error still popup. I need to cancel (button X) to go further, losing everything else I did.

5- The third section of displayed form list in runtime (the most to the right) does not display the total row count on Mac OS. The window is most of the time too big in height.

Thank you and nice interface!

Bonjour F.i.SCIENCES, Je vois que vous êtes de Lévis :wink: je suis de St-Jean-sur-Richelieu…

About the Canadian postal code, this is what I have done:
I use custom “Display Type”
Menu > Setup > Display Type
Add a new display Type
Name it “CodePostal”
Enable the Regular Expression toggle-button
And set a regex at the Mask Field

The following regdex
[1]\d[ABCEGHJ-NPRSTV-Zabceghj-nprstv-z]?\d[ABCEGHJ-NPRSTV-Zabceghj-nprstv-z]\d$
would allow as input
G6J 0P3
G6J0P3
g6j0p3
etc

In your form, set this Display Type

image

In the same From field, I had add event “On Exit” called "to Code PostalFormat

image

Then the postal code input is transformed to the proper format “G6J 0P3”
by calling this function (yes it can be a one liner function …)

function toCodePostalFormat(five, context, result) {
let codePostal = five.field.CodePostal;
let codePostalFormat = codePostal.toUpperCase().replace(/\W/g,‘’).replace(/(…)/,'$1 ');
five.field.CodePostal = codePostalFormat;
return five.success(result);
}

I do the same with the telephone number.

J’espère que ça va vous aidez!


  1. ABCEGHJ-NPRSTVXYabceghj-nprstvxy ↩︎

1 Like

Hi f.i.SCIENCES,

Point 1. There are a couple of ways to go about this, firstly, exactly what Jean has provided for you. Also if you read through this thread you’ll see I’ve answered through the thread that you can also add a display type without a regex expression, you can just define you own mask.

Adding Records into Database - How do I? - Five Community Forums

Point 2. I think there could be a misconfiguration on your form to the associated table and Five can’t map the field correctly. Please verify everything on the form is correct in the fields being mapped to the table. Alternatively, I could email you privately and you could export your application in an FDF file and send it to me to have a look.

Point 3. By default, Five takes the value in the first field on your form and enters it into the app bar up the top, however, I have attached an FDF that you can import and have listed the steps below to show you how you can get more than one field data in the app bar.

MultiFieldTitle.fdf (2.9 MB)

Steps

  1. Import the FDF I have attached.

  2. Navigate to Tables under the Data menu and you will see a table called Customers. The table has a field called FullName and I still have Name and Surname fields as well.

  1. Navigate to Forms under the Visual menu and you will see a field called FullName, ensure you include this field in the list.

  1. Navigate to Functions under the Logic menu, select the UpdateFullName record in the list and click in the Code field to open the editor. The code is using the field property on the Five object with the fieldID from the form to concat the Name and SurName fields. The code is provided below.

function UpdateFullName(five, context, result) {
five.field.FullName = five.field.Name + ’ ’ + five.field.Surname
return five.success(result);
}

  1. Just cancel out of the editor and the form.

  2. Navigate to Forms again under the Visual menu, select the Customers record and navigate down to the field records again.

  3. First select the Name field, click the Events tab ad attach the UpdateFullName function to the On Exit event. Do this also for the Surname field.

Tip: On events execute on the browser, Do events execute on the server.

  1. Now select the FullName field, click the Display tab and type false in the Show If field.

Tip: If fields take JavaScript statements, so by typing false in the field, the field won’t show on your form.

  1. Save your form again and run your application.

  2. You can now enter a name and a surname and on exiting each of the fields they are populated in the app bar.

Point 4. Sorry I can’t reproduce your scenario. I’ll let you know what I did and you can let me know what steps I have missed. I did this in the running application.

Steps

  1. I used a form that had a list page type, ie, I clicked the tab at the top and the list appears on the right.

  2. Click the Add button.

  3. Fill in the form and left a required field empty.

  4. Clicked the Save button. (Received an error, which is correct.)

  5. Clicked the Cancel button on the form as I don’t have the Delete button here. The form is removed and I return to the list.

We are doing something different, because Five won’t let me return to the list without filling in a required field. Could you please tell me the steps I am missing to reproduce your error.

Point 5. At the moment we don’t display the total row on the list most to the right, however, thank you of informing us of this, we will take this on board as its a good idea and thanks for the compliment about the user interface!

I’ll wait to here back from you to help you further.

Jo-Anne, I think you sent me the message below in error. It seems to be addressed to f.i.SCIENCES.

Thanks…

Ron Mittelman

Thank you, I just emailed him to ensure he has seen it as it is still appearing on this thread.

Hi Jo-Anne,
First, thank you for your explanations.

1- OK. But where is the doc about masking format (not regex)?

2- I have deleted the record and recreated it. The problem is gone. It has something to do with renaming a field in the table after this record was already created.

3- Perfect!

4- Don’t do the Cancel button, delete the newly added line with the missing data and try to save. You will get the same error.

5- Yes you do :wink: Look at this image, the row count it’s there but cuted horizontally because the window height is to big.

Don’t forget I use a Mac OS computer.
Have a nice day!

Hi Jean24,

Content de voir d’autre Canadien ici.

All seems fine with this except three things.

1- If I try to set min/max length value (1 to 10 or 10 to 10), I cannot enter anything in the field form. Leaving them empty will let me enter digits.

2- Even if I do not have set min/max integer value, I’ll get this error message. If I set it from 10000000000 to 9999999999. Same problem. Why?

3- Could you resend me the regex for the postal code? It got all mess up with special chars.

Thank you and have a nice day.

For the point 2, it’s an Integer (32 bits) issue. I had to store the field in the DB as text. Because phone number 4188084839 is bigger than 32 bits.

The only problem left is that the list form of phone number doesn’t show up with the Custom Display Type I set in the form. Why? But the edition form is OK.

Salut f.i.SCIENCES

For the telephone number, I didn’t put any min or max. My Display Type is text, not integer.
The mask can be 999 999-9999 but this accepts number with less than 10 digits such as “418 808-483”.
The mask easily allow to store the phone number with no “punctuation” such as 4188084839, but a function validating the number of digit must be implemented.

On the other side a regex validates the exact number of digits on input or update.
image
This mask allows 4188084839 (418)808-4839 418.808.4839 but needs a function that transform the format to the official phone format 418 808-4839

For the postal code, same issue, the mask “a9a 9a9” can do the job but does not validate the number of characters, and also allows invalid postal codes such code with leading Z or containing the letter ‘O’.
The regex I uses does not show up properly in this message. I found your web site, I’ll send it through it.
Jean

Great, thank you. All received and working!

Hi f.i.SCIENCES,

I’m glad your mask is working from Jean’s help. In regards to your other points:

  1. There is no documentaion of masks formatting at this point in our online help, as Five was continually being developed, now that we have a stable platform the documentation is constantly being updated and more and more documentation is continually being added. In the meantime the following can help you:

Mask string. Default format characters are:
9 : 0-9
a : A-Z, a-z
* : A-Z, a-z, 0-9

Any character can be escaped with a backslash. It will appear as a double backslash in JS strings. For example, a German phone mask with unremoveable prefix +49 will look like mask="+4\9 99 999 99" or mask={'+4\\9 99 999 99'}

  1. We are currently implementing a 62 bit Integer data type.

  2. Glad that is working for you!

  3. I have esculated this to our QA team.

  4. I can see now that you have a grid page type, thanks for bringing this to our attention, it has been passed onto our QA team.

1 Like

Hi f.i.SCIENCES,

I have just tested a mask on a custom display type and can see it retains the mask in the field, however, not in the list. This has been esculated to our QA team. Thanks for bringing this to our attention.

1 Like