Control Views
Run Time Control Views (RTCV) provide a way to define column controls at run time based on the date. This view type defines standard DSP control statuses for columns on a page.
There are three control statuses:
- 0 – Disabled
- 1 – Enabled
- 2 – Hidden
There are three types of RTCVs:
- Data Control View (DCV) – Defines control based on what is known about the data on the page.
- Page Control View (PCV) - Defines control based on what is known about the page as a whole, including the parent page.
- User Control Page (UCV) - Defines control based on what is known about the user.
Page and Column Control
When a page loads, DSP uses the following approach to determine the page and column controls:
- WebApp Security Group
- Page Properties
- Page Column Properties
- UCV
- PCV
- DCV
In this hierarchy, the most restrictive prevails. Once the control status of a column has been limits, it cannot be made less strict. For example, if one of the controls on a page sets a column to hidden (2), the column is hidden even if another RTVC or property sets the column to enabled (1).
In terms of DSP:
- Hidden always wins.
- Disabled beats enabled.
- If nothing hides or disables the column, the column is enabled.
General Guidelines for Data Control Views
The following guidelines should be used when creating Data Control Views:
- Use the naming convention webXXXDcv, where XXX is the name of the page.
- Use a DCV when the control status determinations are to be made based on what is known about the data on the page.
- Include all key and criteria columns on the page to control.
- Include all column names for the technical names of the columns on the page that contain the control status values (0, 1, 2).
- Prefix the column containing status with boaCtl when assigning a control status to a Key Column. For example, if the column is called ‘Oracle_Value’, you would alias it to ‘boaCtlOracle_Value’.
The use of boaCtl Prefix
For a WebApp page using a Data Control View, DSP needs to know the primary key of the record that is selected.
Therefore, the view for the Data Control View has to include all of the fields that make up the primary key. These columns use the actual field names
If you are using a Data Control View to Disable (0), Enable (1) or Hide (2) a primary key field, you have to add the logic in a new column, and alias it, so that the column name does not conflict with an existing column name.
DSP requires that the alias uses the 'boaCtl' + 'PrimaryKeyName' naming convention.
DCV Creation Guidelines
For this post, we will use the following naming convention:
- Data Control View: web[PageName]Dcv
- Table: dcsFinDim_SubAccount_xRef
- Horizontal View: webdcsFinDim_SubAccount_xRefHor
- Key field: Oracle_Value
Task
- Create a Data Control View that will perform the following functions:
-
Add:
- When you click on Add, the key field is Enabled for editing.
-
Edit:
- When you click on Edit, the key field is Disabled for editing.
Creating your DCV
In SQL
- Open Management Studio
- Locate the DataConstructionServer database you are working with, and expand it.
- Right-click Views.
- Select New View.
- Click the Views
- Select the webdcsFinDim_SubAccount_xRefHor (Find your appropriate view) view.
- Click the Add
- Click the Close
- Add the Oracle_Value column to the view.
- Enter CASE WHEN Oracle_Value IS NOT NULL THEN 0 ELSE 1 END in the Column
- Enter boaCtlOracle_Value (Use boaCtl[ColumnName]) in Alias
webSubAccountDcs
SELECT Oracle_Value, CASE WHEN Oracle_Value IS NOT NULL THEN 0 ELSE 1 END AS
boaCtlOracle_Value
FROM dbo.webdcsFinDim_SubAccount_xRefHor
Select Statement
- Click the Save button.
- Name the view webSubAccountDcv (Use the web[PageName]Dcv naming convention).
- Click OK.
In DSP
- Now you need to register the new Data Control View to the page.
- Return to DSP.
- Navigate to Construct > Cross References > Global References > Sub-Account.
- Once on the Sub-Account page, click the Tools button, located in the top right corner of the page.
- Select Design.
- Click the Vertical View
- Click the Control View
- Click the Edit
- Select webSubAccountDcv (Choose the one you created) from the Data Control View list box.
- Click the Save
- Close the Sub-Account (Close the window you are in) window.
- Click the Browser Refresh
***NOTE: The Oracle_Value field will now be disabled during an Edit, and enabled during an Add. ***
Review
Return to DSP. Click on the Browser Refresh button. The Oracle_Value field is now enabled during an Add action.
Return to DSP. Click on the Browser Refresh button. The Oracle_Value field is now disabled during an Edit action.
***NOTE: Additional Data Control Views can be added to the same view as necessary. ***
Troubleshooting
If you have registered the DCV to the page, and the DCV doesn’t work, here are a couple of troubleshooting tips:
- Refresh the page.
- Clear the Cache. Navigate to Admin > Configuration > Parameters > Click the Clear Cache
- You can try removing the page, and re-adding it. You will also need to re-add the page to the Menu links.
Comments
0 comments