Hello all
First of all i'm french, so sorry for my bad english.
I start developping in navision, and i would like to show on form
for company 1 field 1
for company 2 field 2
actualy i use this:
IF STRPOS(COMPANYNAME,'comp1') > 0 THEN BEGIN
CurrForm."field1".VISIBLE := TRUE;
CurrForm."field2".VISIBLE := FALSE;
IF STRPOS(COMPANYNAME,'comp1') > 0 THEN BEGIN
CurrForm."field1".VISIBLE := FALSE;
CurrForm."field2".VISIBLE := TRUE;
](*,)
It is quiet heavy to past it in each form
So i wonder if there is a methode (using table, fonction, codeunit ...) to do this more cleanly [-o<
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
So using RecordRef variables you could make fields non editable via undelying table's fields ENABLED property. Unfortunately table fields have no VISIBLE property
and when i read this record in my form i put my condition.
An other solution is to create a new table which contain company and field to show. So when i open form and read this table I test if this field exist and so I steal read in the table if i show it or not
However i find the requirement to be very strange - why the view is dependent on a company selected ? It is mopre common when view is dependent on user and/or its role - for example company managers can see more or different information than accountants or sales persons and so on...
You need to explain WHAT you are trying to achieve, not HOW you want to achieve it.
I have two societies : S1 , S2, and one form F1, and two, fields C1, C2
if the user select S1 and F1 he have to see C1 and not C2
if the user select S2 and F1 he have to see C2 and not C1
I meant what is the business requirement: What are fields C1 and C2 why do they need different fields for different companies?
Do they really need ot use two different fields or could they use the same field for both companies?
If it's just displaying data, you can create a function that returns the value based on the company you are on, then just display that function.