Number format with control characters - why?

Version independent discussion forum
thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 188
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Number format with control characters - why?

Post by thomas.uttendorfer » 05 Apr 2017, 08:29

This is a post from the old gupta forum where I found some new answer to - so I copied the original:
Hello,

does anybody know why in the format section the number masks has control characters included (see picture). When I create new one, they didn't. :?: :!:
This happens with all versions of TD, including 6.2 SP1.

.head 3 - Number: 0'%'
.head 3 - Number: #0
.head 3 - Number: ###000
.head 3 - Number: ###000;'('###000')'

You could see them in a texteditor, if the sourcefile was saved as text.

Best regards,

Joerg Bertram
Control characters in SAL outline.jpg
[\Quote]
You do not have the required permissions to view the files attached to this post.
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 188
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Number format with control characters - why?

Post by thomas.uttendorfer » 05 Apr 2017, 10:24

We found some clues to the format section in .apt files:
When you add a format in the "Format"-property of a datafield control - this format shows up in the apt in two places
  • n the Global Declarations Fromat section
  • and in the controls property.
For number formats there appear control characters for decimalpoint and thousands-separator, currency and maybe more.
This is kind of clever since the apt could be opened in an environment where other regional settings are active (e.g. in Germany the decimal-point is a comma, in US it's a point).

Why does it appear twice?
I suppose this is kind of a service for developers since entries from the global format section will be listed in the dropdown boxes of the control properties.
But then a gupta-bug jumps in:
  • When you edit formats in the global format section manually then the control character disappear and will be replaced by those you see on the screen (dot and comma for example).
  • But then they are useless for TD because it cannot Interpret it correctly anymore.
  • And you won't see the difference between a format with or without correct control characters!
  • If you select such a format in the properties of a datafield control then it has no effect since TD cannot Interpret it correctly.
So my recommendation is:
Remove the formats in the global format section as soon as possible. Don't give anybody in your team to edit them manually.
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

User avatar
H3PO4
Germany
Posts: 261
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Number format with control characters - why?

Post by H3PO4 » 05 Apr 2017, 10:26

Hello Thomas,

my answer would be:

Gupta-created formats while making a new application are falsely inserted as ASCII characters (You can verify this with a hex-view on your apt-file).

When you open this file in notepad++ the Formats in ASCII look like control characters.

New inserted formats are in Unicode.

Happy coding!

Henning

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 188
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Number format with control characters - why?

Post by thomas.uttendorfer » 05 Apr 2017, 11:27

What I forgot to tell:
We investigated the format sections since we had all of a sudden strange app crashes with our compiled application.
We opened (and closed) different form windows which are located in different .apd
After about doing so with about 6 or 7 different forms we got regularly an app crash with BEX and StackHash_xxxx.

After we cleared the format section in each an every .apt and compiled again - we got rid of that nasty problem.
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

FRBhote
India
Posts: 2202
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Number format with control characters - why?

Post by FRBhote » 05 Apr 2017, 12:55

That's been a problem since forever. If possible keep nothing in the formats section - or at least regularly remove as much as you can.

Leave the dates as they are useful and don't cause a problem - it's always the number formats.

J.Bertram
Germany
Posts: 39
Joined: 21 Mar 2017, 09:15
Location: Karlsruhe, Germany

Number format with control characters - why?

Post by J.Bertram » 06 Apr 2017, 05:33

We also recognized that some crashes are directly related to the format section. Thanks to Thomas, we now know the exact context! Merci!
Joerg Bertram

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 2837
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Number format with control characters - why?

Post by Dave Rabelink » 06 Apr 2017, 06:10

Another thing to consider when using dynalibs (apd's):

https://wiki.tdcommunity.net/index.ph ... el_windows
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 188
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Number format with control characters - why?

Post by thomas.uttendorfer » 13 Apr 2017, 14:25

Update:

In our case deleting all formats from the global format section made things worse.

What we now do:
We made a tool with cdk which extracts all formats of every datafield and column-control of all of our .apt.
We then made a distinct list of the formats and applied them to the global format section of all of our .apt.
Now things are a bit better.

Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 467
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

Re: Number format with control characters - why?

Post by Uwe van der Horst » 18 Jun 2019, 15:50

Dave Rabelink wrote:
06 Apr 2017, 06:10
Another thing to consider when using dynalibs (apd's):

https://wiki.tdcommunity.net/index.php? ... el_windows

Symptoms
When using top level windows (forms, dialog boxes etc) from dynalibs, formats/input masks defined on fields within the dynalib top level windows do not work.
When trying to enter data into the fields, these issues could emerge :


All data can be entered, the formats and input masks seem not to be present
Data can not be entered, the field seems to be locked
A GPF occurs when entering data into the field


Cause
When the list of formats/input masks in the main application differs from those defined in the dynalib, TD seems not to make the dynalib formats available
to the main application. So the main application only uses the formats/input masks defined within the main source only.


Remedy/workaround
You need to make the dynalib(s) formats section equal to the main application formats section.
Copy all needed formats from the dynalib and place them into the formats section of the main application.
Also the sequence of formats is important. So it is best to copy/paste the complete section.
Full quote here. After going from 7.0.3 to 7.1.2 we had this strange things in dynalibs. Even worse: After entering a number (data field with format #.##0,00) and pressing Enter or Tab a "99" was automatically added before the entered number (e.g. 100,00 -> 99100). Some customers did not realize this until after some hours of work. After restarting our application the symptoms disappeared for a while. NOT REPRODUCABLE. I followed Dave's hint to make all formats available to the main application. This was a lot of work but solved the problem. I did not change the apds.
Best regards,
Uwe van der Horst
Advo-web GmbH

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests