nerdexam
Microsoft

MB6-704 · Question #28

You need to write X++ code that is common to both the CustTable table and the VendTable table. The solution must minimize the duplication of code. What should you do?

The correct answer is D. Create a map that links CustTable and VendTable. Write X++ code that uses the map. A map can unify the access to similar columns and methods that are present in multiple tables. You associate a map field with a field in one or more tables. This enables you to use the same field name to access fields with different names in different tables. Methods on maps…

Develop Application Objects

Question

You need to write X++ code that is common to both the CustTable table and the VendTable table. The solution must minimize the duplication of code. What should you do?

Options

  • AModify CustTable to add all of the fields in VendTable. Write X* + code that uses CustTable.
  • BCreate a view that includes the fields in both CustTable and VendTable. Write X+ + code that uses
  • CCreate a table that extends from CustTable and VendTable. Write X+ + code that uses the newtable.
  • DCreate a map that links CustTable and VendTable. Write X++ code that uses the map.

How the community answered

(30 responses)
  • A
    10% (3)
  • B
    3% (1)
  • C
    3% (1)
  • D
    83% (25)

Explanation

A map can unify the access to similar columns and methods that are present in multiple tables. You associate a map field with a field in one or more tables. This enables you to use the same field name to access fields with different names in different tables. Methods on maps enable you to create or modify methods that act on the table fields that the map references. The benefits of maps include: * Code reuse - a map method enables you to add code that runs against the map fields. A single map method prevents the duplication of methods and code on each table. * Simplicity - maps provide a single interface to fields in multiple tables. This means that any object referencing the map field can be used against multiple tables without changing any field * Consistency - table fields with varying names can be accessed in code in a consistent manner. For example by using a map, fields named Zip in one table, ZipCode in another, and PostalCode in yet another table can all be accessed by the name ZipCode.

Topics

#table map#code reuse#CustTable#VendTable

Community Discussion

No community discussion yet for this question.

Full MB6-704 Practice