How dataformats works?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
DevGiu
AppGini Super Hero
AppGini Super Hero
Posts: 151
Joined: 2016-05-27 09:08

How dataformats works?

Post by DevGiu » 2016-09-25 17:15

I'm trying to create a dataformat to set content of a field as uppercase.

I edited my dataFormats.cfg and added a new line

Code: Select all

UPPER; UPPER(%%FIELD%%)
I set my field with this format:
Selección_110.png
Selección_110.png (28 KiB) Viewed 5804 times
But I don't see any difference when I create, update or show my records.
/Giuseppe
Professional Outsourcing Services

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: How dataformats works?

Post by grimblefritz » 2016-09-25 22:02

Did you exit AppGini and restart?

Make sure you add your customizations to the end of the file. I ran into issues trying to insert them, especially after updating AppGini.

Make sure you are using an editor that retains the end-of-line convention. That file is installed using Unix EOL (LF). Not sure, but it might hiccup if converted to DOS EOL (CRLF).

Lastly, since it's a mysql function that's being applied, it is ONLY applied during insert/update. (For those expecting it might act as an input mask.) This means if your data is already present in the database in lower/mixed case, it will be displayed as such. Upon saving, it should be forced to UPPER and subsequently retrieved "converted".

Personally, I do not like the data formats feature and avoid using it if at all possible.

DevGiu
AppGini Super Hero
AppGini Super Hero
Posts: 151
Joined: 2016-05-27 09:08

Re: How dataformats works?

Post by DevGiu » 2016-09-26 07:36

grimblefritz wrote:Did you exit AppGini and restart?
Yes. For this my dataformat appears on dropdown.
Make sure you add your customizations to the end of the file. I ran into issues trying to insert them, especially after updating AppGini.

Make sure you are using an editor that retains the end-of-line convention. That file is installed using Unix EOL (LF). Not sure, but it might hiccup if converted to DOS EOL (CRLF).
I'm checking it, and is with LF
screenshot_001.png
screenshot_001.png (112.67 KiB) Viewed 5791 times
Lastly, since it's a mysql function that's being applied, it is ONLY applied during insert/update. (For those expecting it might act as an input mask.) This means if your data is already present in the database in lower/mixed case, it will be displayed as such. Upon saving, it should be forced to UPPER and subsequently retrieved "converted".
I know. I'm not looking for input mask, I just want to make sure all is converted to uppercase on save.
Personally, I do not like the data formats feature and avoid using it if at all possible.
Yes, I don't like too much either, but, I would like to use all provided by AppGini and avoid to write unnecessary code.
/Giuseppe
Professional Outsourcing Services

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: How dataformats works?

Post by grimblefritz » 2016-09-26 12:18

All that being said, I have no had any problem getting custom data formats to work. I don't understand why yours is not.

DevGiu
AppGini Super Hero
AppGini Super Hero
Posts: 151
Joined: 2016-05-27 09:08

Re: How dataformats works?

Post by DevGiu » 2016-09-26 12:25

Can you try this exact UPPRR dataformat please?
/Giuseppe
Professional Outsourcing Services

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: How dataformats works?

Post by grimblefritz » 2016-09-26 13:23

It would seem there's a bug in 5.51

From the .axp, using the 12 hour data format (the last one in the original file):

Code: Select all

      <dataFormat>
        <![CDATA[13]]>
</dataFormat>
This results in the following in the generated code:

Code: Select all

# grep -r FORMAT
incCommon.php:                  'customer' => "`customer`.`id` as 'id', DATE_FORMAT(`customer`.`name`, '%h:%i %p') as 'name'",
customer_view.php:              "DATE_FORMAT(`customer`.`name`, '%h:%i %p')" => "name"
customer_view.php:              "DATE_FORMAT(`customer`.`name`, '%h:%i %p')" => "name"
customer_view.php:              "DATE_FORMAT(`customer`.`name`, '%h:%i %p')" => "name"
admin/pageViewMembers.php:      $res=sql("select lcase(m.memberID), g.name, DATE_FORMAT(m.signupDate, '" . makeSafe($adminConfig['MySQLDateFormat'], false) . "'), m.custom1, m.custom2, m.custom3, m.custom4, m.isBanned, m.isApproved from membership_users m left join membership_groups g on m.groupID=g.groupID $where order by m.signupDate limit $start, " . intval($adminConfig['membersPerPage']), $eo);
Then, changing the data format of 'name' to ANY custom format... in the .axp:

Code: Select all

      <dataFormat>
        <![CDATA[14]]>
</dataFormat>
But in the generated code:

Code: Select all

# grep -r customer...name
ajax_combo.php:                         'parent_caption' => '`customer`.`name`',
ajax_combo.php:                         'parent_caption' => '`customer`.`name`',
ajax_combo.php:                         'parent_caption' => '`customer`.`name`',
incCommon.php:                  'customer' => "`customer`.`id` as 'id', `customer`.`name` as 'name'",
customer_view.php:              "`customer`.`name`" => "name"
customer_view.php:              "`customer`.`name`" => "name"
customer_view.php:              "`customer`.`name`" => "Name"
customer_view.php:              "`customer`.`name`" => "name"
So I swapped the 12 hour and UPPER lines, thinking perhaps the file was being truncated at 13 (original count) lines. Interestingly, it (UPPER) still did not work.

I suggest this be forwarded to support as a major bug.

DevGiu
AppGini Super Hero
AppGini Super Hero
Posts: 151
Joined: 2016-05-27 09:08

Re: How dataformats works?

Post by DevGiu » 2016-09-26 15:47

I had opened a ticket for other reasons, and I mentioned data formats don't works.
/Giuseppe
Professional Outsourcing Services

Post Reply