Adding Source Name in Item Ledger Entry

aceXaceX Member Posts: 166
edited 2014-08-06 in NAV Three Tier
Hi, I have some problem with adding Source Name (Text 50) field in Page: Item Ledger Entries
I'm doing this:
1. Add Global variable Source Name in Page
2. In properties of Source Name, in Table Relation property I'm creating this:
IF (Source Type=CONST(Customer)) Customer.Name WHERE (No.=FIELD(Source No.)) ELSE IF (Source Type=CONST(Vendor)) Vendor.Name WHERE (No.=FIELD(Source No.))

First Where No. (No. from Customer Table) and second Where No. (from Vendor Table)

But nothing happens??

Answers

  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
    [Topic moved from 'Dynamics CRM (formerly CRM)' to 'NAV Three Tier' forum]
  • aceXaceX Member Posts: 166
    For my question from yesterday, I want to ask, does have any way to add checking from two tables in FlowField - CalcFormula property. I have this now:
    Lookup(Vendor.Name WHERE (No.=FIELD(Source No.)))
    
    but I want something like this
    Lookup(Vendor.Name WHERE (No.=FIELD(Source No.)) AND Customer.Name WHERE(No.=FIELD(Source No.)))
    

    Also I want to apologize for posting my question in wrong module. ](*,)

    Regards to all
  • TonyDuarteTonyDuarte Member Posts: 92
    For the Source Name I would recomend you to do it by C/AL Code, in the OnAfterGeRecord of the page.

    And for the lookup, I dunno if you can do an IF, where the true part would be customer and the false part vendor.

    something like:

    IF ( SourceName=Customer,
    Lookup(Customer.Name WHERE(No.=FIELD(Source No.))), <- True part
    Lookup(Vendor.Name WHERE (No.=FIELD(Source No.))) <- False part

    Don't know exactly the right method, or even if it will work.

    You can even try to do the lookup formula as a textfield and assign to that field the lookup according to the right calculation...
  • aceXaceX Member Posts: 166
    Thank you TonyDuarte for your suggestion. I've put loop with "if case else" in AfterGetRecord trigger and everything works perfectly.
    You have open my eyes :). Thanks again

    Regards to all
Sign In or Register to comment.