Coding controls of Currform in variables possible?

rocopsarocopsa Member Posts: 38
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!

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    No, in this way that's not possible. Why do you want to set them to invisible? What do you want to achieve? I guess you know that an invisible column can be set to visible again.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • rocopsarocopsa Member Posts: 38
    Dear einsTeIn.NET,

    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!
  • ProcatProcat Member Posts: 31
    Would putting all the controls on a frame and hide the frame solve it?
  • JedrzejTJedrzejT Member Posts: 267
    Hi,
    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
  • rocopsarocopsa Member Posts: 38
    Thanks for the reply.

    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. :)
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    rocopsa wrote:
    Actually I just wanted to save coding only. Since it is clumsy to list out all the columns one by one
    That's not what you want to achieve, that's the way how you would like to solve it.

    rocopsa wrote:
    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.
    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.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
Sign In or Register to comment.