Question
click below
click below
Question
Normal Size Small Size show me how
Mendix Intermediate
Building an Event app using Microflows
Question | Answer |
---|---|
Feedback | It allows you to continuously keep improving the app to better suit the user’s needs. Provide information such as user role, page name and screen resolution |
How can you Make the Mendix Feedback app reusable | Make a snippet. |
Snippets | are reusable interface parts that can be used on pages and layouts. Changes you make to a snippet will be applied in all places where this snippet is used. -> DRY |
Where can you find the FeedbackWidget? | In the App Explorer you can find the snippet FeedbackWidget. ➢ The snippet has automatically been added to your project. |
Where can you find the App Id? | In the Project Tab of the Feedback Widget |
Where can we find the Account entity (User Object)? | in the Administration module (Marketplace modules -> Administration -> Account) |
Where can we find the Fullname and the Email Attribute? | in the Administration module |
How can you let Mendix Studio Pro help you find possible security issues? | ‘Check security’ option set to Yes. in the App security |
How can a Mendix app run on a licenced environment? | A Mendix app can only run on a licensed environment when the App Security level is set to ‘Production’. Without this security level set correctly, the app will not deploy to non-local environments |
How can you change he App Security settings? | 1. Go to the App Security and change the security level from ‘Off’ to ‘Production’. 2. Go to the user roles tab. Create a new user role named ’ and let this generate a corresponding module role in the MyFirstModule module. |
When changing the app to Production and add a new user role / mole role, what read Access errors do we get? | No read access to attribute ‘FullName’ in entity ‘Administration.Account’ for user role ‘EventManager’ (with no roles defined in module ‘Administration’)’. (and also for the Email entity) |
Behalve de Read access errors, krijgen we ook nog een andere error. Welke is dat? | No access to entity ‘Administration.Account’ for user role ‘EventManager’ (with no roles defined in module ‘Administration’)’. |
How can you get more information on the reasoning why this error appears? | you can right click on the error and select ‘Show details…’. This will show you the navigation path of how the user with that user role will be able to navigate to a page where access is not set-up correctly. |
To set-up your security properly, you need to perform a few steps. what is the 1 step? | You need to go to the App Security and add the module role ‘User’ of the Administration module to the user role ‘Event Manager’. |
We now see that there is a different error which states: At least one allowed role must be selected if the page is used from navigation or a button. | This is because we have a navigation item in our app navigation that refers to the page ‘Home_Web’. And without any module role connected to it, no one can access the page, so this error makes perfect sense. |
We’re almost there, but if you go to the App Security you can see that the app status is still set to incomplete, so let’s fix that. | Open up the security for the DataWidgets module Go to the entity access tab and click New. Select the DataGrid entity and click OK. Select the User module role and set all attributes to read. |
How can you generate a page? | Right-click on an entity and select the option Generate Overview Pages…. This function will generate the Overview page and NewEdit page for the selected entity. |
What can happen when you use the Generate Page button? | because Mendix will otherwise create a menu snippet for all these pages and add it to the specific pages |
How can you make sure that the user can access those pages? | Give the correct module role access to the Overview pages |
Waarom krijg je nu 3 errors "No read access to attrbitue "Name" in entity EventManagement.Artist for the user role Event Manager? | Because you allow a user role to view pages with information but you haven't configured the entity security yet. |
Hoe kan je dit probleem oplossen? | Ga naar Module Security van de EventManagement module en ga naar de tab Entity Access. Zorg ervoor dat je de entiteit selecteert waarvan je de access rules wilt veranderen naar Read/Write access |
Hoe kan je ervoor zorgen dat je maar 1 object terugkrijgt in je Retrieve action? | The microflow should retrieve a single EventInformation object (set the Range to first), then check if anything is found and if not create a new instance. |
Hoe kan je er makkelijk voor zorgen dat het mogelijk is om accounts aan te maken? | Mendix has a page for that, so you only need to add it to the navigation. Add a navigation item Change the on-click action to show a page And find the Account_Overview page within the Adminstration module. |
What is the easiest way to collect feedback from users from within your app? | Use the Feedback widget. |
Where is page access configured?Is it possible limit an entity to only one object? | Module Security |
What would be a reasonable validation rule to use for AllowedNumberOfVisitorsPerDay? | Range <= 1000 |
How can you easily manage accounts for your app? | Connect navigation to the built-in Account_Overview page |
Is it possible limit an entity to only one object? | Yes, through a Microflow |
Keep Control over your microflows | use sub-microflows |
How do sub-microflows help you? | The use of sub microflows helps you improve the readability, but also makes it easier to reuse and maintain (parts of) your complex microflows. |
You want to add validation to the program information the event manager will enter. For this reason, you will add a... | commit event to the ProgramItem entity from your domain model. |
When creating the event handler please make sure that you untick the ‘Raise an error when the microflow returns false’. This is because we | want to give our own notifications and not the default error messages. If you have a different scenario where you are not using your own error messages you can leave this tick box ticked. |
Hoe kan je een sub microflow maken: | Select the variable and all the checks for the required fields. Then right-click the selection and choose Extract sub-microflow. |
Wanneer kan je een foutmelding krijgen als je probeert om een sub-microflow te extracten? | This is probably because you have selected a Parameter and/or a Start event. You can’t select an End event either. Make sure you don’t select any of them when creating the sub-microflow. |
Best Practice creating sub microflows: | Create a maximum of 2 – 3 levels of sub-microflows |
Keep track of the functionality you built | -> use Documentation |
Add Documentation | -Properties of Microflows or domain model -Properties of a entity |
Annotations | The level of documentation in the annotations is important because you want the information to say something relevant but not be too long, to the point that it has to be updated with every minor change |
Rules | ➢ The rule is more limited in its capabilities due to the nature of its existence. ➢ Microflows can be used for the same purpose and additionally can delete, commit, call integration operations, have client interaction and much more. |
Waarom gebruik je rules vooral? | to evaluate data and return an outcome based on that evaluation. Microflows can be used for the same purpose and additionally can delete, commit, call integration operations and have client interaction |
The limitation of a rule depends on the activiities that you choose to use. You can use the following types of activities within rules: | • Cast object • Retrieve • Aggregate list • Change list • Create list • List operation • Java action call • Microflow call • Change variable • Create variable • Log message |
Excluding microflows | it will no longer be evaluated by Mendix Studio Pro but you still can see everything in this document. The alternative is to delete a document, but you would no longer be able to see it. |
How can you exclude documents from a project? | You can exclude documents from within your project explorer by selecting a document and using the right-click mouse action Exclude from project. |
Now you need to add a split condition in the rule that will check two things: - The String is not empty - The String is not cleared or only consists of whitespaces | you can use the expression: trim($InputString) !='' |
Hoe kan je een regel toevoegen aan je project? | You can add it by right-clicking on your module folder and then select Add other > Rule. |
Welke waarde heeft een Rule altijd? | a Boolean or Enumeration |
What is a limitation of a sub-microflow compared to a regular microflow? | None. Sub-microflows are equally capable. |
What main benefit do sub-microflows offer? | Better maintainability |
If you want to leave notes for future developers (or yourself) in a microflow, what can you use? | Annotations |
What is a limitation of a rule compared to a microflow? | You have a smaller selection of activities. |
You’ve replaced a microflow with newer functionality and want to test it. However, you don’t want to delete the old microflow permanently in case something goes wrong. How can you do this? | Exclude it from the project. |
Licenced environment | Switch security To Production. So Users are forced to login the app |
Why Anonymous User? | Allows you to show pages and give access to users that are not logged in. Think of a Webshop |
Waar kan je de optie voor Anonymous users aanzetten? | The setting to enable the anonymous user can be found in the App security under the tab Anonymous users within Mendix Studio Pro |
Wat moet er nog meer gedaan worden, behalve het aanzetten van Anonymous users, voordat ze iets kunnen doen? | When you have enabled the anonymous user, it is neccessary to add a role-based home page for the Anonymous user role. This changes the landing page, for every user going to the designated URL, from login page to the designed Anonymous page. |
Variables | Variables can exist as a single object, a list of objects, or a primitive (single) value. |
Welke Types Variables zijn er in een Microflow? | Object A single instance of an entity, defined by an entity in the domain model Create, change, delete Purpose – store data |
List of objects | A list of the objects of a specific entity Create, change (set, add) List functions o Aggregate a list o List operation Purpose – do something with the list of objects |
Wat zit er in een Aggregate List? | Sum, average, count, minimum, maximum |
Wat zit er in een List Operation? | Union, intersect, subtract, contains, equals, sort, filter, find, head, tail |
Primitive variables | Can be of different value types: Boolean, date and time, decimal, enumeration, integer/long, string |
Primitive Variables purpose | Purpose – temporary storage of values for use within microflow logic (for example, for keeping track of a value or counting the times you’ve iterated over a list) |
Variables access | in microflows are indicated with a dollar sign ($) and are followed by the name of the variable. |
Variables can be inserted into microflows in different ways: | As an input parameter Can be retrieved via a Retrieve activity. Used as an output value for a microflow (return value). |
Token | is a special type of variable. A token is a system-generated value that can be used in microflows, for example in Exclusive Splits or XPath Constraints. |
Welke Tokens zijn er? | Current User token the Current Object token and User Role tokens. |
The Current User contains the ID of the current user object. | For example, the current moment (accurate to the millisecond) can be identified using ‘[%CurrentDateTime%]’, and the current user ID can be accessed by using ‘[%CurrentUser%]’. |
Microflow expressions = are there to help you in defining your logic within your business processes. | ➢ in your microflows and rules. |
Examples of different areas to use Microflow Expressions | Split conditions • Create and change object actions • Create and change of variables • Output of end events • Arguments for parameters (Java Actions, sub-microflow calls, etc.) |
Hoe kan je de prioriteiten van de berekeningen in Microflow expressies vastleggen? | you can work with brackets to determine the priority of the calculations. |
Formatting and Parsing | In a situation where your DateTime input (or output) is in a format different than the one used by Mendix, you can use formatting and parsing. |
Formatting is transforming date into text, and parsing is converting text into date. | formatDateTime parseDateTime. |
Creating an Anonymous User Role | Create a user role called Anonymous in the App security. Go to the tab Anonymous users and set allow anonymous users to Yes and select the just created user role as the anonymous user role. |
Loop Example | we need a Loop to iterate over the found days. With each iteration, we will check the number of bought tickets for that day and compare that to the maximum number of users for a day. |
Search for a user role -> retrieve the User Role of the visitor. We are only searching for one user role and not a list. Please use the following Xpath: | [id = ‘[%UserRole_Visitor%]’] |
Debugger | Mendix Studio Pro has a built-in consistency checker that validates whether the application you are modeling contains any technical errors. |
Place Breakpoint | at the beginning of a process. |
How can you allow users to access parts of an app (like a login page) without needing to log in? | Set up anonymous users. |
In a microflow, what is a token? | A system-generated value. |
In a microflow expression, “toUpperCase” is an example of what? | A function |
In a microflow, what would be an example of a variable? | $Customer |
You need to debug a microflow in production but don’t want to impact your users. How can you trigger debugging only when you personally are running the microflow? | Set a breakpoint condition. |
Scheduled Events | With a scheduled event, you can let your app execute a microflow at a specific moment in time. This can also be repeated with a given interval, for example, an hour, day, or minute. ➢ The microflow is only executed if the scheduled event is enabled. |
Loops | are used to iterate over a list of objects. ➢ For every object in a list, the flow inside the loop is executed. . ➢ Additionally, a loop (and only a loop) can contain break events and continue events |
Iterator | The object which the loop iterates over is called the iterator and looks the same as an input parameter of a microflow. |
Aggregate List | can be used to calculate aggregated values such as the maximum, minimum, sum, average, and total amount of objects over a list of objects. |
Aggregate functions | can also be used in combination with a retrieve. As you may know, when a retrieve to the database is done, a query is sent to the database. |
Optimized Retrieve | A retrieve from database followed by an aggregate list action will result in an optimized retrieve. |
Batches | Batches will break up the large data set into smaller parts called batches, allowing you to update subsets of records one at a time, instead of processing them all at once. |
How can you have a microflow automatically run at a specific moment in time? | Create and enable a scheduled event. |
What can you use to exit a loop early, instead of finishing the entire list of iterator objects? | A break event |
You want to find the total number of objects in a list. What can you easily use to do this? | Use an aggregate list function. |
What are batches used for? | Processing large amounts of data |
What is the list object in a loop called? | iterator |