Developing the Setup Process
The Setup process is crucial for defining and storing the currencies that the system will track. Follow these steps to create and configure the Setup process:
1. Create a New Pool and Set Data Root
Open the Process Designer in Emakin.
Create a New Pool: Click on the "New Pool" button to add a new pool to your process.
In the pool creation dialog, name the pool "Setup".
Set Data Root: During the creation of the pool, specify a new Data Root and name it "CurrencySetup".
2. Configure the Initial Task
Inside the newly created "Setup" pool, an initial task will be automatically created. This task will be highlighted in green, indicating that it is an initiating task for the end users.
Rename the Task:
Click on the initial task to select it.
Change the name of the task to "Exchange Rate Setup".
Add a Save Action:
Within the task configuration, add a "Save" action.
This action will be the one visible to end users when they open this task, allowing them to save the setup data.
3. Define Setup Data and Configure Prework and Postwork
Postwork:
In the postwork section of the "Exchange Rate Setup" task, add the following code to save the setup data:
$Xml.CommitDeletes();
$Xml.Save('.', 'CurrencyManager/CurrencySetup');
This code will save the SetupData under the CurrencySetup in the XML database.
Prework:
In the prework section of the "Exchange Rate Setup" task, add the following code to load the setup data from the XML database:
$Xml.Load('CurrencySetup/*');
This code ensures that the setup data is loaded and available on the form when the task is opened.
4. Design the Form
Open the Form Designer.
Add a Table Content to the form. This table will be used for entering the base currencies.
Name this table content "Currencies".
Inside the "Currencies" table, add a text field for entering the base currency. Name this field "Currency".
Add the Nested Table Content:
Inside the "Currencies" table, add another Table Content. This nested table will be used for entering the target currencies corresponding to each base currency.
Name this nested table content "Targets".
Inside the "Targets" table, add a text field for entering the target currency. Name this field "Currency".
Form Layout: Arrange the form layout to ensure that the nested "Targets" table is properly positioned within the editor of the "Currencies" table.
Your form should look like this:
Here is a running version of the form with some data:
Here is the XML data of the form above:
<CurrencySetup>
<Currencies>
<Base State="Default">
<Currency>EUR</Currency>
<Targets>
<Target State="Default">
<Currency>USD</Currency>
</Target>
<Target>
<Currency>GBP</Currency>
</Target>
</Targets>
</Base>
<Base>
<Currency>USD</Currency>
<Targets>
<Target>
<Currency>EUR</Currency>
</Target>
<Target>
<Currency>GBP</Currency>
</Target>
</Targets>
</Base>
</Currencies>
<Rates/>
</CurrencySetup>
Copyright © 2010 - 2023 Emakin. All rights reserved.