PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Customer specific captions
Customer specific captions
Débuté par SolutionJ-Reg, 30 oct. 2014 19:35 - 7 réponses
Posté le 30 octobre 2014 - 19:35
Hi,

I want to allow different companies who use a computer system I've written to choose different names for certain database fields.

So, for example, I might have a field called ProductID, which has a caption in the Analysis set to 'Product', but a particular company might want to see this as 'Item' on every form and report it appears on.

Currently I do this in code which examines the caption of every data field on every form and report as they open. I enclose the caption on the form/report in # (so e.g. #Product#) and then use string functions to replace it with the required value which I retrieve from a table.

This works, but is complex and must slow the system down. Is there a better way of doing this?

Cheers
Reg
Posté le 30 octobre 2014 - 21:44
Hi Reg,

Here's what I do:
Put the changeable field captions in fields in a global one-record parameter file, where the user can give any names to them.

Replace the field names in forms with something like ProdId..Caption = PARAM.ProdIdName.

If these fields are used in tables and reports, they must be moved to column headers with something like Table.ProdIdName..Caption = PARAM.ProdIdName

And you can take this even further by defining the caption names in the product group (or category) file, so that they can be different in different category products.

If these are optional fields, and their caption fields are empty, then grey them or make them invisible.

Best regards
Ola
Posté le 31 octobre 2014 - 09:19
Hi Reg,

if the speed is a problem, you could try to use MyWindow..DisplayEnabled before and after the replacement in your window.

// Before the replacement:
MyWindow..DisplayEnabled = False

// Your caption replacements
// ...

// After the replacement:
MyWindow..DisplayEnabled = True

The window is than refreshed ones.
Posté le 31 octobre 2014 - 09:21
Hi Stefan,

Thanks, that's a good idea.

Cheers
Reg
Posté le 31 octobre 2014 - 09:21
Hi Ola,

Thanks for this, it sounds like a cleaner way to do it.

Cheers
Reg
Posté le 31 octobre 2014 - 09:37
I would do this in the opening section of a window. Before the window is shown in the first place.
Otherwise the user may see thee 'old' caption first and then the change to a new caption.

I can;t imagine speed will be a problem, at least not the drawing part. Or you must have dozens of controls, which could possibly change.
If you read the new captions from let's say the database, just be sure to create proper indexes on the table holding this info.
Or use an array and read these values once, ie when starting.
Posté le 31 octobre 2014 - 09:38
Thanks Arie
Posté le 31 octobre 2014 - 11:06
How about using the user defined languages 1-15

set up each caption variation at language level and dynamically select the coorect language 1 to 15 for each company

Dave