Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FORMAT Built-in Function [CORE3776] #4120

Closed
firebird-automations opened this issue Feb 26, 2012 · 10 comments
Closed

FORMAT Built-in Function [CORE3776] #4120

firebird-automations opened this issue Feb 26, 2012 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Miguel Suarez (kiux)

Duplicates CORE1314

THIS ISSUE IS NOT EQUAL TO CORE1314

Hi Firebird developers,

Are you able to develop the "FORMAT" Built-in Function for Firebird? I think that you can.

Sample: SELECT FORMAT(0.125, '0.00%') FROM ...
Returns: '12.50%'

Sample: SELECT FORMAT(CURRENT_DATE, 'dddd, MMM d yyyy') FROM ...
Returns: 'Sunday, Feb 26 2012'

Sample: SELECT FORMAT(5459.4, 'US$#⁠#⁠,#⁠#⁠0.00') FROM ...
Returns: 'US$5,459.40'

THIS ISSUE IS NOT EQUAL TO CORE1314

@firebird-automations
Copy link
Collaborator Author

Modified by: Miguel Suarez (kiux)

description: Hi Firebird developers,

Are you able to develop the "FORMAT" Built-in Function for Firebird? I think that you can.

Sample: SELECT FORMAT(0.125, '0.00%') FROM ...
Returns: '12.50%'

Sample: SELECT FORMAT(CURENT_DATE, 'dddd, MMM d yyyy') FROM ...
Returns: 'Sunday, Feb 26 2012'

Sample: SELECT FORMAT(5459.4, 'US$#⁠#⁠,#⁠#⁠0.00') FROM ...
Returns: 'US$5,459.40'

=>

Hi Firebird developers,

Are you able to develop the "FORMAT" Built-in Function for Firebird? I think that you can.

Sample: SELECT FORMAT(0.125, '0.00%') FROM ...
Returns: '12.50%'

Sample: SELECT FORMAT(CURRENT_DATE, 'dddd, MMM d yyyy') FROM ...
Returns: 'Sunday, Feb 26 2012'

Sample: SELECT FORMAT(5459.4, 'US$#⁠#⁠,#⁠#⁠0.00') FROM ...
Returns: 'US$5,459.40'

@firebird-automations
Copy link
Collaborator Author

Modified by: Miguel Suarez (kiux)

timeestimate: 1209600 [ 1209600 ]

timeoriginalestimate: 1209600 [ 1209600 ]

Component: Engine [ 10000 ]

Component: UDF [ 10002 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: Miguel Suarez (kiux)

timeestimate: 1209600 [ 1209600 ] =>

timeoriginalestimate: 1209600 [ 1209600 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Duplicates CORE1314.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue duplicates CORE1314 [ CORE1314 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Miguel Suarez (kiux)

description: Hi Firebird developers,

Are you able to develop the "FORMAT" Built-in Function for Firebird? I think that you can.

Sample: SELECT FORMAT(0.125, '0.00%') FROM ...
Returns: '12.50%'

Sample: SELECT FORMAT(CURRENT_DATE, 'dddd, MMM d yyyy') FROM ...
Returns: 'Sunday, Feb 26 2012'

Sample: SELECT FORMAT(5459.4, 'US$#⁠#⁠,#⁠#⁠0.00') FROM ...
Returns: 'US$5,459.40'

=>

THIS ISSUE IS NOT EQUAL TO CORE1314

Hi Firebird developers,

Are you able to develop the "FORMAT" Built-in Function for Firebird? I think that you can.

Sample: SELECT FORMAT(0.125, '0.00%') FROM ...
Returns: '12.50%'

Sample: SELECT FORMAT(CURRENT_DATE, 'dddd, MMM d yyyy') FROM ...
Returns: 'Sunday, Feb 26 2012'

Sample: SELECT FORMAT(5459.4, 'US$#⁠#⁠,#⁠#⁠0.00') FROM ...
Returns: 'US$5,459.40'

THIS ISSUE IS NOT EQUAL TO CORE1314

@firebird-automations
Copy link
Collaborator Author

Commented by: Miguel Suarez (kiux)

Adriano,

The Issue CORE3776 is not equal to CORE1314.

If you read CORE1314, the "proposed solution" does not solve the functionality proposed in this ticket.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

The tickets talks about the same thing. Both are surely very naively described, BTW, which leaves the complete design to the developer.

This is, however, not the reason it was not added yet. The reason is described in CORE1341 comment.

@firebird-automations
Copy link
Collaborator Author

Commented by: Van den Wouwer Danny (dannyvdw)

Is this kind of functionality indeed needed in the Firebird engine?

My personal opnion says that formatting data should be done on the presentation layer, it is there that you know the culture/environment of the user.

One of the examples says:
SELECT FORMAT(0.125, '0.00%') FROM ...
Returns: '12.50%'
Not here in belgium, we use a comma as decimal seperator, not a point!

This means, to correct the example above, you should use something like this:
SELECT FORMAT(0.125, '0.00%', 'nl-BE') FROM ...
Returns: '12,50%'

And probably it will not stop here,
what if one one the input parameters is null?
what if the specified format-string isn't compatible with the data?
SELECT FORMAT(123, 'd', 'nl-BE') FROM ...
Returns: ?

Formatting is much more complex then adding a STRING_FORMAT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant