Dear experts,
Your suggestions please!
I have a form with >20 columns needed to be shown/hidden dynamically. I know I can do it one by one for each columns like:
CurrForm."PJ Post Right".VISIBLE(TRUE);
CurrForm."PT Post Right".VISIBLE(TRUE);
CurrForm."FA Post Right".VISIBLE(TRUE);
.....
But, is it possible to do it through for example FieldNo + Repeat function so as to save the need for coding? Since the columns are having IDs in sequence 50000..50031.
Like:
i:=50000;
REPEAT
i+=1;
CurrForm.i.VISIBLE(TRUE);
UNTIL i=50030;
I know the above is not possible, is there any way like this can do the job?
Thanks in advance!
0
Comments
Actually I just wanted to save coding only. Since it is clumsy to list out all the columns one by one like:
IF <<some condition>> THEN
BEGIN
CurrForm."PJ Post Right".VISIBLE(TRUE);
CurrForm."PT Post Right".VISIBLE(TRUE);
CurrForm."FA Post Right".VISIBLE(TRUE);
.....
END ELSE
BEGIN
CurrForm."PJ Post Right".VISIBLE(FALSE);
CurrForm."PT Post Right".VISIBLE(FALSE);
CurrForm."FA Post Right".VISIBLE(FALSE);
...
END;
By the way, I've tried to use fieldref to get the corresponding table fields to see whether it is possible, but still, in vain.
************************
i:=50000; //say, the columns with field no. as 50001..50030.
rrec81.OPEN(81);
REPEAT
i+=1;
fref:=rrec81.FIELD(i);
IF <<some condition>> THEN
BEGIN
CurrForm.fref.VISIBLE(TRUE);
CurrForm.fref.ENABLED(TRUE);
END ELSE
BEGIN
CurrForm.fref.VISIBLE(TRUE);
CurrForm.fref.ENABLED(TRUE);
END;
UNTIL i =50030;
rrec81.CLOSE;
************************
So, it seems that form controls cannot be represented by variables and the clumsy codes are inevitable.
Anyway, thanks!
Users can be not happy when they see navision dont remember form settings and standard functionality did not work (hiden columns can be visible after your function) . Sometimes better create 2 form instead of doing change like that
Actually the <<some condition>> is sort of permission checking that is different by Role of each ID plus some settings. So, it may be too dynamic (too many case results) to be done through frame or split by different forms.
Anyway, thanks for all of your ideas.
That's your request! So, you want to hide some columns from certain users depending on the permissions and some individual settings. Please search the forum for this goal, read all posts carefully and then rethink about it. There are many possibilities to bypass the mentioned solutions. You should explain it to your customer and if it's really necessary to hide that data from some users then they should think about reorganization of their workflow.