MPS Template use of parameter - mps

In MPS I have defined a template:
template reduce_Car
Input Car
parameters
color : String
<TF [<Car>???</Car>] TF>
Now I wanted to use the defined parameter "color" in my template?

You access parameters through genContext. So wrap the text to replace with a property macro
<TF [<Car>$[red]</Car>] TF>
and down in the Inspector for the property macro access the parameter as 'genContext.color'

Related

Access content field from views in Orchard CMS 1.10.1

I would like to display certain first level menuitem in bold.
This setting should be done by a checkbox when the user create / edit a menu item. (I have a workaround using the Model.Href, but it is not nice).
So I created a boolean field in Content definition / Menuitem URL (I don't know the name of the corresponding content definition in English Orchard).
How to access a custom field (Content Field) from a view?
(There already is a view which is used to customize the menu)
The examples I found use custom shapes, where the fields are accessed as built in fields (e.g. Model.ContentItem.FieldName ). But this is a different case.
With the help of "Piedone", the solution:
Model.Content.ContentItem.MenuItem.FieldTechnicalName.Value
Explanation
Examining the Model object in Visual Studio, the Model is a dynamic shape that have eg. Href property and a Content.
Content is a MenuPart, that is a content part that have a ContentItem property with the content item itself. Technically only content parts have Fields. When you (seemingly) add a field to a type it will be a part corresponding the type's name, that is MenuItem in this case (It's confusing that the display name of 'MenuItem' content type is Custom Link...)
The field's technical name is as you name it. When you add to a type, the Value will be a property of the BooleanField class. (By the way, it is nullable, so if you dont't save after adding the field, it will be null else the value you set).

Access node's properties/children from inline template

I have a template switch where, based on the node's concept, I want to create runtime objects using that node's properties and/or children. The right-hand side of each case is an inline template. How do I access node's properties/children from that inline template? More specifically, in the screenshot below, the arguments to the line() and rectangle() methods need to be extracted from the corresponding LineCommand and Rectangle nodes.
Note that the Alt+Enter menu doesn't offer to "Add a Property Macro".
I am using MPS 2018.1.5.
In order to extract an argument from the node's children you need to add the template argument (e.g. "null") and then put the macro on it. Then in the process of generation, the template argument (null) will be replaced with the generation target of the node's children.
If you want to use the node's property, then you should add a more specific argument (e.g. empty string) and put the caret to the property cell (between the quotes) and then you will see the "Add Property Macro" intention
template argument
template argument with the property
add property macro
Add a dummy argument first and then use Alt+Enter on the argument to add a macro to replace it with something from the node.

Parameterization of object's properties in UFT?

I need to dynamically handle the object properties through code in my project as many of the object values are changing dynamically. So is there any way to parameterize object's properties in UFT?
To parameterize Object's Properties you need to Open your Object Repository in Object Repository Manager and go to Tools > Manage Repository Parameters and here you will get a window named as Manage Repository Parameters.
In this window click on "+" button and add Name, Default Value and Description of the parameter.
Till here you have successfully added the Dynamic Parameter.
Now to assign this parameter to an object what you need to do is just click on your object in which you want to use this property and then configure the value of required description property by pressing Ctrl + F11. Now from Repository Parameter window you can select "Parameter" radio box and select the property you added before and click OK.
After doing all these steps use this object in your code by just writing the below code and you are good to go with Parameterization of your Object.
Repository.Value("AddedObject") = "ValueYouWantToPassInRequiredProperty"

How do I reference custom EL function in ADF page fragments

I would like to create a static (helper) function which will check if a given variable belongs to a set of predefined values. I want to use it as an EL function in order to reference it in a jsff file (via java's EL). The question is: how do I reference the custom function inside the JSFF since it is a page fragment and I cannot access the form templates which the fragment belongs to due to its compilation.
You can have an element from your jsff binded on this function by setting the function's class as the jsff scope in the adfc-config.xml in the "managed-bean" tab and the calling it as follow :
<af:outputText
id="pt1"
viewId="#{YOURSCOPE.YOURBEAN.YOURFUNCTION}"
You'll get a detailled how to in the documentation here : http://docs.oracle.com/cd/E17904_01/web.1111/b31974/web_getstarted.htm#ADFFD1746

drupal 6 cck format in custom template file

i'm creating a custom .tpl file for a node type with some cck fields.
In de cck module i selected a integer format style for a field.
Now in the tpl i load the field from the $node object but it's without format (9999 in stead of 9.999).
In the $node object you have an item '#theme' and '#formatter', i guess i need one of these but how?
i tried the theme() function but then it doesn't display anything.
i've used content_view($node); to 'render' all the values.
Putting this on the top of the page gave me an array with all the right (themed) values.

Resources