global constants?

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

global constants?

Postby Neale » Fri Aug 15, 2003 5:11 am

Just like a Global Variable, but initialised to a value on solution startup and unmodifiable.

Any chance?

Speaking of initialising on solution startup, is it possible to run a method as part of solution initialisation (other than the obvious hack of connecting it with the solution's startup screen)?

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby maarten » Tue Aug 26, 2003 6:54 pm

Just like a Global Variable, but initialised to a value on solution startup and unmodifiable.

You can perfectly initialise globals at startup with a startup script.
Globals are not modifiable by users, only if the developer explicitly wants that, so why would you want an extra "constante" option that basically is already there.

Speaking of initialising on solution startup, is it possible to run a method as part of solution initialisation (other than the obvious hack of connecting it with the solution's startup screen)?

For the time being not possible. I've sent this request to dev. team.

Thanks for input.
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Re: global constants?

Postby Jan Blok » Wed Aug 27, 2003 1:21 pm

Neale wrote:Speaking of initialising on solution startup, is it possible to run a method as part of solution initialisation (other than the obvious hack of connecting it with the solution's startup screen)?


It is now on the planning to have a solution startup method (which will always be connected to a form)
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby Neale » Wed Aug 27, 2003 2:05 pm

Cool, thanks. :=-)

But... it'd still be nice to have Global Constants. E.g. see http://forum.servoy.com/viewtopic.php?t=342

The point is not so much what users might do, but rather that something which MUST remain constant really should withstand the onslaught of whoever gets to modify the solution in future (i.e. if one of these variables gets modified, the results will be "interesting", to say the least!).

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby jcompagner » Thu Sep 04, 2003 2:30 pm

Can you give me an example where you would have a Constant Global variable?
Where do you use this global?
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby Neale » Thu Sep 04, 2003 11:51 pm

One example is where you have a customer table and a related addresses table. In the simplest case the relation can be made by copying the customer id to a field in the address record.

But if we now want to have separate billing and delivery addresses, both in the existing addresses table but distinguishable. So we add an addr-type field (e.g. B=billing, D=delivery). Now tha relationship is a little more involved - for the billing address we use the constant value "B" plus the id and for Delivery "D" plus the id.

The only wayI can see to do this is to use pre-initialised global variables in the relationships (one var for each relationship). This appears to work, but implies the very fundamental assumptions that the global variables (a) are always correctly initialiased and (b) never get changed. Both these assumptions should go away if the relationship used a "global constant".

That help?

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby Harjo » Fri Sep 05, 2003 12:03 am

Make a stored calculation: return "B";

This will give you an constant-value too!
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby Neale » Mon Sep 08, 2003 3:27 am

Yes, this seems like a valid workaround.

But I presume you meant UNstored calculation? I can't imagine why we'd want to store that value (much less in every record!).

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby maarten » Mon Sep 08, 2003 9:04 am

You can't use unstored key in a relation.

We discussed this point and are thinking of
offering literal values in relations.
(just type your key as a "text/number" instead of using a column).
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Neale » Mon Sep 08, 2003 10:59 am

maarten wrote:You can't use unstored key in a relation.

Hmm... it let me do it here???? Or is there something more subtle I should check?

maarten wrote:We discussed this point and are thinking of
offering literal values in relations.
(just type your key as a "text/number" instead of using a column).

That'd work for me. But I'd still settle for a global constant ;-)

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby maarten » Mon Sep 08, 2003 11:54 am

maarten wrote:

You can't use unstored key in a relation.


Hmm... it let me do it here???? Or is there something more subtle I should check?

You're right Neale, (not possible on right hand side)

That'd work for me. But I'd still settle for a global constant

...both are on the wish list :)
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands


Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 21 guests

cron