Constraining data with XPath Flashcards

1
Q

What is the main purpose of using XPath in Mendix?

A

The main purpose of using XPath in Mendix is to navigate the domain model when interacting with data, allowing developers to retrieve specific data they need by constraining it using entities, attributes, associations, and variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does XPath help developers in displaying data on Mendix pages?

A

XPath helps developers in displaying data on Mendix pages by enabling them to retrieve specific data from the Mendix database and present it on a page. For example, it can be used to display a list of products ordered by a user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why does Mendix prefer XPath over syntaxes like SQL or OQL for data retrieval?

A

Mendix prefers XPath over syntaxes like SQL or OQL for data retrieval because XPath offers database universality and ease of use. It also seamlessly meshes with the association and attribute structure of the domain model, making queries easily understandable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In what situations are XPaths commonly used in Mendix applications?

A

XPaths are commonly used in nearly every Mendix application because they are essential for thoughtful data presentation and are used to navigate and retrieve data from the domain model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does XPath relate to entities and attributes in the Mendix domain model?

A

XPath relates to entities and attributes in the Mendix domain model by allowing developers to specify relationships between data properties. It works seamlessly with the association and attribute structure of the domain model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Where can we use XPath?

A

Pages, Microflows and Security.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In an XPath query, explain the purpose of the tokens “//”, “.”, “/”, and “[ ]”. Provide an example of an XPath query that uses these tokens.

A

In an XPath query:

”//” designates the beginning of the query and allows you to query objects in the entire domain model.
“.” separates module names from entity names.
“/” is used to refer to a new entity or association, allowing you to navigate through the domain model.
“[ ]” is used to define constraints on attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Given the XPath query: “//Sales.Customer[TotalAmount > 1000]”, what does this query do?

A

The XPath query “//Sales.Customer[TotalAmount > 1000]” retrieves all customers in the “Sales” module whose “TotalAmount” attribute is greater than €1000. It filters and retrieves only those customers who have spent more than €1000.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you access auto-completion for constructing XPath constraints in the Mendix platform, and when does it open automatically?

A

Auto-completion for XPath constraints in the Mendix platform can be accessed in two ways:

  1. It opens automatically when you type an open bracket [ or a slash /.
  2. You can also trigger auto-completion by pressing CTRL+Space. This is particularly useful if you lose auto-completion due to mistyping or clicking elsewhere.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where in Mendix Studio Pro can you configure XPaths?

A

List Views

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which Widget feature utilizes XPaths?

A

Selectable data constraints on Reference Selectors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where can you utilize XPaths in microflows?

A

In the ‘Retrieve’ action.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are Mendix System Variables, and how do they assist in XPath creation?

A

Mendix System Variables are special variables provided by the Mendix platform that help in creating XPaths. They include references to the current user, user roles, session information, dates, and times. These variables are accessed by starting with ‘[%’ and using the ctrl-space auto-complete menu.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In what situations should you avoid using the ‘[%CurrentUser%]’ variable in Mendix?

A

You should avoid using the ‘[%CurrentUser%]’ variable in system processes like Scheduled Events and After Startup microflows because there is no user context available at those times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Say you are writing an XPath in a Retrieve action for the VacationRequest entity in a Microflow. If you write in the XPath window [Status = ‘Cancelled’], what will be returned?

A

A list of all requests with the status set to ‘Cancelled’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Say you are writing an XPath in a Retrieve action on the VacationRequest entity in a Microflow. If you write in the XPath window [VacationRequest.VacationRequest_Submitter=’[%CurrentUser%]’], what will be returned?

A

A list of all vacation requests submitted by the current user.

17
Q

The value represents the total amount of days used for the requested vacation. If you write a microflow with a Retrieve action, what will be the return if we use the following XPath

[DaysUsed < 4.5
and not(VacationManagement.VacationRequest_Submitter/Administration.Account)] ?

A

A list of all VacationRequests that are shorter than 4.5 days and do not have a Submitter assigned.

18
Q

Say you are writing an XPath in a Retrieve action on the VacationRequest entity in a Microflow. If you write in the XPath window [VacationRequest.VacationRequest_Submitter=’[%CurrentUser%]’], what will be returned?

A

A list of all vacation requests submitted by the current user.

19
Q

If you want to convert 18-09-2023 over to 18 september 2023, what function should you use?

A

toString()

20
Q

What’s the difference between the empty value and the not() function?

A

The empty value checks whether an attribute or association has a value or not

The not() function checks if certain conditions have been met or not, if associations are populated,