Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Setting DBMONEY Environment variable at runtime from within a genero program.  (Read 10137 times)
Avichal N.
Posts: 5


« on: May 08, 2017, 01:25:42 am »

Hi

We have an application that displays currency values with the symbol based on the DBMONEY.

We have a situation where we want to display different currency symbol based on a specific country (or customer from a specific country).
Eg: If a customer is from UK we want o display £ or if the customer is french then display: €

We thought it would be possible by changing the DBMONEY environment variable at runtime using the fgl_setenv function call, but it does not work. I can see the env variable changing by using the fgl_getenv variable, but it still does not display against the money values.

If i change the variable before running the program, then it works fine.

Has anyone been able to use multi currency in one application (program) ?

Any help will be appreciated.

Thanks

Avichal
Sebastien F.
Four Js
Posts: 509


« Reply #1 on: May 08, 2017, 10:32:10 am »

Hello,

What version of Genero do you use?

You cannot change back and forth DBMONEY/DBFORMAT/DBDATE during program execution.

I think you will have to handle this by hand, especially if you want to display different currency symbols in the same form.

You need to write your own formatting functions.

Seb
Avichal N.
Posts: 5


« Reply #2 on: May 09, 2017, 01:26:07 am »

Hi Seb

Thanks for your reply.

We are using Genero 3.00.09 rev-73a75e5.

I was looking at easier option to handle this, instead of making too much changes to the code. But if it cant be done then I guess I wont have much option.

Thanks

Avichal
Sebastien F.
Four Js
Posts: 509


« Reply #3 on: May 09, 2017, 09:09:39 am »

Avichal,

Seems that this will affect a lot of your forms, so you need to make the right decision before doing modifications in your code.
I though that this concerns only a few forms with specific fields where the currency symbol can change...

If you want to handle the formatting of DECIMAL/MONEY fields by hand, this will mean that you will have to change the data type of the fields to STRING...
And I am not sure this is a good idea, you lose all automatic input controls done for you by Genero, decimal computing,  interface with database will be affected...

Maybe there are other options that could fit your needs, for example, keep the variables, db columns and form fields as DECIMAL, and add a currency symbol field beside, as a combobox?

I suggest that you open a support case so we can better investigate with you on this.

Seb
Avichal N.
Posts: 5


« Reply #4 on: May 10, 2017, 02:52:23 am »

Hi Seb

Thanks once again.

Our application is a debt recovery financial application and hence extensively use decimal and money value. So you are right, in our case it is going to a very be tedious task for us to make all the changes.
I tried doing that on individual display to form fields which works, but doing it for arrays and input fields will require lot of changes and data validation if we are to change the variables to string.
Just being able to change DBMONEY at runtime would have made life so much easier.

I have raised a support ticket with 4js: https://agile.strasbourg.4js.com/jira/servicedesk/customer/portal/4/SUPASIA-295  (if this is what you meant)

Rgds

Avichal
Sebastien F.
Four Js
Posts: 509


« Reply #5 on: May 10, 2017, 08:44:52 am »

Hi Avichal,

Definitively you should keep using DECIMAL / MONEY types.

So far, I can tell you that it will not be possible to change DBMONEY/DBFORMAT/DBDATE on the fly:
Especially when connected to the database (Informix!), this would confuse the database client software.

The only proper option I see today is to have a started program that sets these env vars (when the user logs in to the application?)

I assume that if you change the currency on the fly, the numbers change too???
If not, I assume that the currency is to be selected at the beginning of a program execution according to the user settings?

Many questions can raise.
=> We better follow up on SUPASIA-295, to get more details about your application.

Seb
Avichal N.
Posts: 5


« Reply #6 on: May 12, 2017, 08:05:33 am »

Hi Seb

We tried the harder option of changing the "display" in the program.

With the "using" keyword, it is easy to use it on "display to" individual field, but not easy to use it for input field and arrays.
Even with the "display to", we have lot of place where the code is like:

display by name r_fin_charges.*
For the above example we have to break it to individual field and display
eg:
display r_fin_charges.fin_debtor_amount using g_v_money to fin_debtor_amount
g_v_money is defined as: let g_v_money = "-",l_currency_symbol,"<<,<<<,<<&.&&"
l_currency_symbol is derived from the database based on the client country.

Problem:
To avoid currency display in arrays and input statement, we exported the DBMONEY to blank space with we run the application.
export DBMONEY=" "
With this everything works ok. Wherever we are using "display using" its displaying correctly, and in arrays, no currency is displayed, same goes for input variable statement.
EXCEPT IF THE CURRENCY USED IS "$"
Except for "$", all other currencies gets displayed correctly. For "$", no currency symbol is displayed.
So now the question is - is the empty DBMONEY string causing this issue.???? What can we do to fix this.
I can see the g_v_money getting the correct format defined:
G_V_MONEY : -$<<,<<<,<<&.&&
Sebastien F.
Four Js
Posts: 509


« Reply #7 on: May 12, 2017, 09:06:22 am »

Avichal,

I suggest that we communicate through the support channel, I see you are also exchanging with Reuben, so we better centralize our discussion there.

Regarding your last comment:

Using DISPLAY TO here and there and setting DBMONEY to " " sounds complex and tricky to me.

You write that your currency is derived from the database based on the client country. So to me this is part of the data that your application should manage.

I would replace all MONEY types by DECIMAL, and dedicate a variable/column for the currency symbol.

I can imagine this is not a simple change, but long term it is maybe a better choice as doing tricky things with DBMONEY, IMHO.

Maybe we could organize a conf call so you can expose all your constraints.

Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines