Logics Editor
Edit Logics
either open (double click) particular logic.json file in your project
or search logics by name - after pressing Ctrl+Shift+L, resp. Cmd+Shift+L
The editor looks like this (the exact look depends on the type of logic you open)
Actions:
Environment, Partition – which Environment and Partition should be used for the execution of actions when clicking Generate (in the Inputs tab), Test Logic, and Deploy Logic buttons.
Test Logic – to test the execution of the logic on the partition. It will retrieve data from the Inputs tab and the code from the Logic elements, then send them for execution on the backend. Once the server returns the results, the editor will switch to the Results tab to display the results of elements.
Write checkbox (Allow Object Modification) – this flag is useful when testing logics, which (when executed normally on the backend) have the rights to modify objects (e.g. logic of types Calculated Field Set or Calculation Flow). See the respective Logic API page to find out, if your logic type has this right.
Deploy Logic – immediately deploys the logic to the specified partition.
Tabs:
Elements – Shows a list of elements and their Basic Properties, Alerts, Description and Display mode. Each element type has its own icon.
Inputs – Allows you to define input parameters for Test Logic action. For details see Test Logics.
Results – Described in Test Logics.
General – Contains the metadata of the logic (Unique Name, Label, Valid After, Status) that can be edited.
Groovy Console – Allows you to test a snippet of code. This code snippet is not saved, so it will be lost when IntelliJ closes. Otherwise execution of the snippet behaves exactly the same, as if you would use Test Logic - i.e. the snippet will have access to the same Parameters, will execute in the same context, etc.
Available Element Actions
Edit element properties – Select the element and modify its properties using the element panel on the right. (This corresponds to the UI options in Pricefx.) You can view these properties also in their text form – if you switch to the Text tab at the bottom.
Edit element content – Double-click the element name and modify the code of the element in a separate tab. Or find the element file (e.g. TargetDateFormatted.groovy) in the tree on the left and double-click it.
Add a new element – Use the "plus" icon next to the element list.Â
Copy an element – Use the "copy" icon next to the element list.
Remove an element – Use the "minus" icon next to the element list.
Edit Elements
When you edit the elements, you can make use of the following Pricefx Studio / IDEA functionality:
Auto-completion – When you type e.g. "api.f", you will get a list of all functions starting with these letters, such as api.find, api.findCustomersInGroup etc. together with their required parameters. This also works for type codes, metadata etc. The auto-completion data is pulled from the partition and environment currently selected in the PfxMetadata panel. See also some auto-completion troubleshooting tips.Â
Quick navigation to elements – When you have an element name in the code, you can Ctrl-click resp. Cmd-click it and you will be directed right to the element file.Â
Easy renaming of multiple occurrences of a variable – Use Shift+F6 which highlights the multiple occurrences and then the edits are done for all of them.
Live templates – IDEA provides possibility to place frequently used code snippets in your code with a single click. Just start typing "pfx" and you will get the list of the code snippets coming with Studio. Using these templates you can create a sample Highchart or ResultMatrix instance in a second. To see the full list of templates and their descriptions, go to IDEA Settings > Editor > Live Templates. There you can also add your own templates.
ÂSearch across the whole project/directory – Use Ctrl+Shift+F resp. Cmd+Shift+F and refine the search.
View JavaDoc of Pricefx public Groovy API function using Ctrl+Q resp. F1 or CTRL+J.
Use IDEA features related to syntax check and version control – To see what was changed and by whom, see the commit description, run comparison, track the ticket number for which a file was created, use handy plugins such as CodeNarc etc.Â
Learn about more Pricefx Studio shortcuts which can speed up your work.Â
Logic File Format
To edit logics, it is important to understand the structure of a project in Pricefx Studio.Â
─── my-project/ project folder
├── CalculationLogic/ folder storing all non-workflow logics
│ ├── Default_logic/ logic folder
│ │ ├── elements/ elements folder
│ │ │ ├── ApprovalReason.groovy element file
│ │ │ ├── ItemGroup.groovy ...
│ │ │ ├── ProductGroup.groovy
│ │ │ ├── ResultPrice.groovy
│ │ │ └── ResultPriceReason.groovy
│ │ ├── logic.json logic file
│ ├── ProductInfo/
├── WorkflowFormula/ folder for workflow logics
├── ProductExtension/ folder for Product extension definitions
│ ...
│── pom.xml maven config file - adds Groovy and TDD4C library. Required for SonarQube
└── config.json config holding PFX connection
Available Fields (PfxMetadata)
Pricefx Studio provides you information on all available objects and fields which you can use when editing logics.Â
Go to the PfxMetadata panel. (If you do not see it, enable it in View > Tool Windows.)Â
Select Environment, Partition and search for a field, for example:Â
When you have an element file open and you double-click a particular field in this PfxMetadata panel, it will get inserted into the element code. This makes the work faster and prevents typos.Â
 For easier navigation in the search results use the Expand All and Collapse All icons at the top.Â
Found an issue in documentation? Write to us.
Â