nerdexam
Microsoft

MB-500 · Question #343

You use Dynamics 365 Finance. You loop through a list of vendor records filtered by the vendor group number. You want to store the vendor account number in a container that will be used later. You…

The correct answer is C. VendTable vendTable; container vendorAccounts; int currentPosition = 1; while select vendTable where vendTable.VendGroup == '10' { vendorAccounts = conIns(vendorAccounts, currentPosition, vendTable.AccountNum); currentPosition++; }. The first element of the container is specified by the number 1. Use CurrentPosition = 1. Use conIns, not conPeek. conIns returns a value so use VendorAccount = conIns.. Use currentPosition++ in the loop. Not A: The first element of the container is specified by the number, not…

Develop business logic

Question

You use Dynamics 365 Finance. You loop through a list of vendor records filtered by the vendor group number. You want to store the vendor account number in a container that will be used later. You need to save the ID in a container. Which code segment should you use? A. B. C. D. E.

Exhibits

MB-500 question #343 exhibit 1
MB-500 question #343 exhibit 2
MB-500 question #343 exhibit 3
MB-500 question #343 exhibit 4
MB-500 question #343 exhibit 5

Options

  • AVendTable vendTable; container vendorAccounts; int currentPosition = 0; while select vendTable where vendTable.VendGroup == '10' { vendorAccounts = conIns(vendorAccounts, currentPosition, vendTable.AccountNum); currentPosition++; }
  • BVendTable vendTable; container vendorAccounts; int currentPosition = 1; while select vendTable where vendTable.VendGroup == '10' { conIns(vendorAccounts, currentPosition, vendTable.AccountNum); currentPosition++; }
  • CVendTable vendTable; container vendorAccounts; int currentPosition = 1; while select vendTable where vendTable.VendGroup == '10' { vendorAccounts = conIns(vendorAccounts, currentPosition, vendTable.AccountNum); currentPosition++; }
  • DVendTable vendTable; container vendorAccounts; int currentPosition = 1; while select vendTable where vendTable.VendGroup == '10' { vendorAccounts = conIns(vendorAccounts, currentPosition, vendTable.AccountNum); }
  • EVendTable vendTable; container vendorAccounts; int currentPosition = 1; while select vendTable where vendTable.VendGroup == '10' { vendorAccounts = conPeek(vendorAccounts, currentPosition, vendTable.AccountNum); currentPosition++; }

How the community answered

(38 responses)
  • A
    11% (4)
  • B
    3% (1)
  • C
    82% (31)
  • E
    5% (2)

Explanation

The first element of the container is specified by the number 1. Use CurrentPosition = 1. Use conIns, not conPeek. conIns returns a value so use VendorAccount = conIns.. Use currentPosition++ in the loop. Not A: The first element of the container is specified by the number, not 0. Not B: conIns return value is a new container that contains the inserted elements. Not D: No currentPosition++ in the loop Not E: Use conIns, not conPeek. Retrieves a specific element from a container and converts it into another data type, if conversion Note: conIns, conPeek X++ container runtime functions These functions manipulate the contents of containers. Inserts one or more elements into a container. A new container that contains the inserted elements. The first element of the container is specified by the number 1. To insert after the n element, the start parameter should be n+1. You can also use the += operator to add values of any type to a container. For example, to create a container that contains the squared values of the first 10 loop iterations, use the following code. for (i = 1; i < = 10; i++) container conIns (container container, int start, anytype element, ... ) static void conInsExample(Args _arg) c = conIns(c,1,"item1"); c = conIns(c,2,"item2"); for (i = 1 ; i <= conLen(c) ; i++) // Prints the content of a container. print conPeek(c, i); https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-container-run- https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-data/xpp-while-

Topics

#X++ containers#conIns#while select#data structures

Community Discussion

No community discussion yet for this question.

Full MB-500 Practice