| View previous topic :: View next topic |
| Author |
Message |
sirdan Novice
Joined: 21 May 2010 Posts: 2
|
Posted: Sat May 22, 2010 5:00 pm Post subject: Set Expression value and text at runtime |
|
|
When creating a Query in XML, you can set the default value and text for an expression in the query. For example:
....
<expressions>
<expr class="ENTATTR" id="MyType.Name" />
<expr class="CONST" type="String" kind="List" value="MyVal" text="MyText" />
</expressions>
How can I do the equivalent set value/text at runtime? I'm not seeing how to access these from the row's condition member. Thanks. |
|
| Back to top |
|
 |
Admin Site Admin
Joined: 07 Nov 2005 Posts: 272
|
Posted: Wed Jun 02, 2010 1:22 pm Post subject: |
|
|
You should access the conditions through Query object (not QueryPanel).
Here is an example:
| Code: | //get the first conditions in the query
Query.Condition cond = query1.Root.Conditions[0];
//check its type (it must be Query.SimpleCondition)
if (cond is Query.SimpleCondition) {
Query.SimpleCondition scond = (Query.SimpleCondition)e.Condition;
//Get the second expression (right part of the condition)
Expression expr = scond.Expressions[1];
//set the value and the text of this expression
expr.Value = "MyValue";
expr.Text = "MyText";
} |
Last edited by Admin on Wed Jun 09, 2010 1:27 pm; edited 1 time in total |
|
| Back to top |
|
 |
sirdan Novice
Joined: 21 May 2010 Posts: 2
|
Posted: Wed Jun 02, 2010 4:52 pm Post subject: thanks |
|
|
| Thank you for the solution. I just had to change e.Condition to "cond" in your example fragment and it works fine. |
|
| Back to top |
|
 |
|