document type with bold for particular entries

lallylally Member Posts: 323
Hi experts,

In customer ledger entries u have a field Document type. In that field u have options . Just i want 2options credit memo, payment,. when u post some transactions with these above options that must be in bold.I am getting colour for these two options. And the same time i want bold also.
CASE "Document Type" OF
"Document Type"::"Credit Memo" :
CurrForm."Document Type".UPDATEFORECOLOR(255);
"Document Type"::Payment :
CurrForm."Document Type".UPDATEFORECOLOR(16711680);
ELSE
CurrForm."Document Type".UPDATEFORECOLOR(0);
END;

I getting some errors when write code for bold. That code is CurrForm."Document Type".UPDATEFONTBOLD(TRUE).
But i am not getting where to write that code. I am not much coder like U.
I am learner. Please provide solution . How to get bold for only above transactions.
where i have to write.
Thanks in advance.
lally

Comments

  • meranamerana Member Posts: 41
    Code seems OK
    but u have to put it in form for wanted field in OnFormat trigger
  • lallylally Member Posts: 323
    Code seems OK
    but u have to put it in form for wanted field in OnFormat trigger

    Thank you merana,


    I think that u did not read that above query what i mentioned about my problem with BOLD. I know that this will work very well in the case of colours. i put that code in on format trigger.But in the case of bold iam not getting errors .I want bold.how to get that bold.Please provide solution for bold
    I hope now can understand my problem.

    thanks in advance
    lally
  • SavatageSavatage Member Posts: 7,142
    i used something similar. For blocked Items it's Bold & Blue
    IF Blocked 
    THEN BEGIN
      CurrForm."No.".UPDATEFORECOLOR(16711680);
      CurrForm."No.".UPDATEFONTBOLD(TRUE);
      END;
    
  • lallylally Member Posts: 323
    Hi experts,



    Please provide solution. Experts u should throw some light to me how to solve this problem. How to get bold for hilighted fields with colour. Solve this this issue. Please rovide solution.

    I hope u can provide solution now.


    thanks
    lally
  • SavatageSavatage Member Posts: 7,142
    The answer was already proived to you above - you just needed to read it.

    1) Put on the ONFormat Trigger of the Field
    2) Use the example to change your code.
    CASE "Document Type" OF 
    "Document Type"::"Credit Memo" : 
      BEGIN
        CurrForm."Document Type".UPDATEFORECOLOR(255); 
        CurrForm."Document Type".UPDATEFONTBOLD(TRUE);
      END;
    "Document Type"::Payment : 
      BEGIN
        CurrForm."Document Type".UPDATEFORECOLOR(16711680); 
        CurrForm."Document Type".UPDATEFONTBOLD(TRUE);
      END;
    ELSE 
    CurrForm."Document Type".UPDATEFORECOLOR(0); 
    END;
    
  • lallylally Member Posts: 323
    Thanks Savatage,


    Thanks for U r help.I am not much coder like u. I am learning right now.
    Please Excuse for this actually i forgot one thing in above my post. In above query Posting date also has to highlight with releavent type.

    Please provide this one also. I hope can solve this one.

    Thanks
    lally
  • SavatageSavatage Member Posts: 7,142
    change CurrForm."Document Type" to CurrForm."Posting Date" & put the code on the onformat of Posting date
  • lallylally Member Posts: 323
    Thanks Savatage,

    Special thanks to u.what u suggested me about that Bold of posting date might be wrong, because every posting date is getting bold. I should not have like that, what I want is
    When the credit memo of document type get blue colour ,only that posting date has to get that credit memo colur and bold.

    Ex :- posting date document type

    03/07/07(blue) credit memo(blue)

    I want like that , so please do this help. I hope now u got what I want. Please provide solution.
    Thanks and regards
    lally
  • WaldoWaldo Member Posts: 3,412
    I hope I understand correctly... .

    OnFormat of Documetn Type:
    CASE "Document Type" OF 
    "Document Type"::"Credit Memo" : 
      BEGIN 
        CurrForm."Document Type".UPDATEFORECOLOR(255); 
        CurrForm."Document Type".UPDATEFONTBOLD(TRUE); 
      END; 
    "Document Type"::Payment : 
      BEGIN 
        CurrForm."Document Type".UPDATEFORECOLOR(16711680); 
        CurrForm."Document Type".UPDATEFONTBOLD(TRUE); 
      END; 
    ELSE 
    CurrForm."Document Type".UPDATEFORECOLOR(0);
    CurrForm."Documetn Type".UPDATEFONTBOLD(FALSE); 
    END;
    

    OnFormat of Posting Date:
    CASE "Document Type" OF 
    "Document Type"::"Credit Memo" : 
      BEGIN 
        CurrForm."Posting Date".UPDATEFORECOLOR(255); 
        CurrForm."Posting Date".UPDATEFONTBOLD(TRUE); 
      END; 
    ELSE 
    CurrForm."Posting Date".UPDATEFORECOLOR(0);
    CurrForm."Posting Date".UPDATEFONTBOLD(FALSE); 
    END;
    

    So, only when it's a credit memo, the posting date is going to have the same settings as document type.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • lallylally Member Posts: 323
    Thanks Waldo & Savatage,

    . Sorry for extending this query ,
    I am trying my self and I am not getting that what I want. That’s why I am extending this query.What u explained waldo & savatage is working properly. Now a small modification when that document type is credit memo it will get one colour.But not only that document type field but that total record has to get that same colour and bold what document type has . Please provide solution . Sorry for extending this query
    Sorry for the trouble

    I hope you will help me guys....

    Thank you
    lally
  • WaldoWaldo Member Posts: 3,412
    You have to copy the code (and rework it a bit like Savatage already mentioned) to the OnFormat-trigger of every field you want to color... .

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • lallylally Member Posts: 323
    Thanks Waldo,

    I tried already what u mentioned. But as per my knowledge I think that above process what I done is not correct. Because in a form u have 40 fields, do we need to add up to 40 fields. Please think about this one. Is it not possible with out adding code to all fields in a form.? I hope u know that code.
    Please forward that one. Please consider this request.
    Sorry for extending this query ,
    I hope I can understand my problem correctly................

    Thanks and regards
    lally
  • WaldoWaldo Member Posts: 3,412
    I have one answer to that: yes, you have to add code for all 40 fields.

    But you could "bundle" a lot in one function (easier to maintain), and call that function from each codeunit.
    One remark with that: you cant update a color of a field when you're not in that OnFormat Trigger ... so when creating one function, you should foresee that only the right code for that specific field is executed.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • lallylally Member Posts: 323
    Thanks Waldo,


    One more special thanks to u r suggestions and solutions.
    Could u explain that what mentioned above . I could not Under stand l.
    Sorry for the trouble. Please excuse me to extend this query.

    Thanks
    lally
  • SavatageSavatage Member Posts: 7,142
    Every Field on the form has it's own OnFormat trigger.

    If you want an entire line to be bold & a color depending on some situation (say "Credit Memo") then you must go to each field and place the code in the OnFormat trigger of each field. All you have to do is make a small change to the code. (I'm just using a section of the full code as an example)
    for example on the OnFormat of "Psoting Date" it should refer to Posting Date
    CurrForm."Posting Date".UPDATEFORECOLOR(255);
    CurrForm."Posting Date".UPDATEFONTBOLD(TRUE);

    On Document type go to the Onformat of that field & change the code
    CurrForm."Document Type".UPDATEFORECOLOR(255);
    CurrForm."Document Type".UPDATEFONTBOLD(TRUE);

    On Amount field go to OnFormat & change the code again
    CurrForm.Amount.UPDATEFORECOLOR(255);
    CurrForm.Amount.UPDATEFONTBOLD(TRUE);

    & so on & so on for every field you have showing.

    Now once you got this down you can maybe think about calling codeunits. A good alternate solution but perhaps a bit advanced for a novice.
    Baby Steps :D
  • WaldoWaldo Member Posts: 3,412
    <edit>

    Posted too late ... :)

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • lallylally Member Posts: 323
    Thanks Savatage & Waldo,

    what u mentioned above for each field individually hilight with out any condition.
    I think u are not understanding my second query.What i would like to have
    when the Document Type = Credit memo then only that total record has to get colour and bold.
    when one case is true then total record has to get that clour and bold.
    I hope now u can understand this one.
    i hope u can provide solution..............

    thanks
    lally
  • SavatageSavatage Member Posts: 7,142
    No, You are not completely reading the posts. If you did, you would have seen that I only used a section of the code as an example so I wouldn't have to type the whole thing which was already given to you in the previous posts.
    Savatage wrote:
    (I'm just using a section of the full code as an example)

    This is as far as I can go on this topic.
  • WaldoWaldo Member Posts: 3,412
    I agree with Savatage.
    Everything you need (and more) is in this thread.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
Sign In or Register to comment.