How to give access to only a subset of data coming from one table?
Option 1: You can build a dynamic query, using a Web Service property to define its “where” clause. You can then dynamically change this where clause with a VG property action. For instance, you can add a “where” clause to a SelectCommand.SqlDataSource property like this:
MySqlDataSource.SelectCommand = {CurrentValue} <new where clause>.
If the query may already contain a “where” clause, you will take it into account with a regular expression like:
#CurrentValue.ToLower.Contains(“ where ”)? string.Format('({0}) and <additional where clause> ', #CurrentValue):string.Format('({0}) where <new where clause> ', #CurrentValue)
Option 2:
You can filter data, after the query is executed and the result set retrieved For instance, VG property actions can dynamically change the following: Property “RowFilter” of a “DataView” • Property “Filter” of a “BindingSource”. • Property “FilterExpression” of a “SqlDataSource”. • When changing such a filter property, we will check if a filter already exists. If so, we add a new clause, otherwise we will create a new filter.
A VG property action can change the filter property with a regular expression like:
#CurrentValue.Length == 0?'<New filter>':string.Format('({0}) <additional filter>, #CurrentValue)
Visual Guard .NET
|