Connect with us and enhance your M-Files experience using Unitfly Toolkit for M-Files. Here’s how to get started.
Hey Folks
Im looking for a solution to solve the generic "every class should have a concated properties Name or Title"-Problem.
Right now im using one Extended Auto Properties rule per class like
{Name} | {Hour} | {Price} | {Date}
Problem / Feature Request
If a property is empty its like "Daniel | 3 | | 11.10.2023".
Im basically missing a SQL function called concat_ws (with separator). This function returns a string resulting from the concatenation, or joining, of two or more string values in an end-to-end manner. It separates those concatenated string values with the delimiter specified in the first function argument.
CONCAT_WS ( separator , argument1 , argument2 [ , argumentN ] ... )
Questions
If I take a look into the documentation i almost found a solution:
https://toolkitformfiles.unitfly.com/documentation/auto-properties/#ternary-operator
Request | If property (Project) is empty, then don’t show it |
Input | <<‘%PROPERTY_1038%’=”?’%PROPERTY_1040%’:’%PROPERTY_1038% – %PROPERTY_1040%’>> |
First, I think the red marked " is an error, right?
Second: Is it possible to use several of these (like for every property im concating?)
Third: Am I allowed to use {Name} instead of %PROPERTY_xxx%?
Regards
Daniel
Unfortunately, currently, there are 2 possible workarounds (until our team develops these proposed work items):
1. Save properties from other data types to property/ies of Text data type. Then with that work on the Property Operations module. I believe this could be temporary, but it is possible.
2. solution would be using Auto Properties with the ternary operator expressions.
You can use nested expressions in Auto Properties.
Example for "{Name} | {Hour}":
<<'{Name}'=''?'{Hour}':'<<'{Hour}'=''?'{Name}':'{Name} | {Hour}'>>'>>
This expression would mean:
IF {Name} is empty
THEN write {Hour}
ELSE
IF {Hour} is empty
THEN write {Name}
ELSE write {Name} | {Hour}
This could get really complicated when you increase the number of parameters. But you can also help yourself by creating multiple rules with different search filters.
Problem / Feature Request
The described use case can be solved using Property Operations and its text function "Concatenate"
The only setback is that, currently, you can only add properties of data types Text or Text (multi-line) as parameters.
Additionally, the "Concatenate" expression is available in Auto Properties, but it does not include adding a separator between properties, you can only add different properties:
<<CONCATENATE(<text1>,<text2>)>>
We've created work items for our developers to:
, and we will contact you as soon as these changes are developed.
Questions
First: Unfortunately, we had problems with quotation marks in our documentation, but all of that should be fixed now.
Second: Yes, it is possible to combine multiple expressions into one, but for your use case I would not recommend it as it could be really complex due to the large number of possibilities
Third: Yes, you are allowed to use {} instead of %PROPERTY_xx%
Posted by: @viktorzagajskiThe only setback is that, currently, you can only add properties of data types Text or Text (multi-line) as parameters.
Are there any workarounds because I need integers as well as dates and of course some single list values. Would it be possible to use other operators to get text back?
regards
Daniel
So, you came to the end of the page. This means you are passionate about technology as we are.
WATCH THE WEBINAR