Salesforce Certified Marketing Cloud Developer · Free Practice Question Medium
Question 4
A developer used LookupRows to retrieve data when building a dynamic email. What should be the next step before using this rowset within a FOR loop?
- A Use Row to return a specific row of the rowset
- B Set the rowset to a new array variable
- C Close the delimited AMPscrlpt Code Block
- D Use RowCount to ensure the rowset contains data
Reveal correct answer
Correct answer: D
Explanation
The correct answer is D. This is the next logical step because before using the rowset within a FOR loop, it is important to confirm whether the rowset actually contains any data. By using RowCount, the developer can check the number of rows in the rowset. If the RowCount is greater than 0, it means that the rowset contains data and can be used in the FOR loop. If the RowCount is 0, it means that the rowset is empty and there is no need to continue with the FOR loop. The other options are incorrect because: A. Using Row to return a specific row of the rowset is not necessary before using the rowset within a FOR loop. It is only required when the developer wants to retrieve a specific row from the rowset. B. Setting the rowset to a new array variable is also not necessary before using the rowset within a FOR loop. It may be useful in some scenarios, but it is not the next step in this case. C. Closing the delimited AMPscript code block is irrelevant to the question and does not affect the usage of the rowset within a FOR loop.Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
