Korzh.com developer tools forums :: View topic - Set Expression value and text at runtime
Korzh.com
home : Community forums  FAQFAQ   SearchSearch  |  RegisterRegister  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Set Expression value and text at runtime

 
Post new topic   Reply to topic    Korzh.com developer tools Forum Index -> EasyQuery WinForms
View previous topic :: View next topic  
Author Message
sirdan
Novice


Joined: 21 May 2010
Posts: 2

PostPosted: Sat May 22, 2010 5:00 pm    Post subject: Set Expression value and text at runtime Reply with quote

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
View user's profile Send private message
Admin
Site Admin


Joined: 07 Nov 2005
Posts: 272

PostPosted: Wed Jun 02, 2010 1:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
sirdan
Novice


Joined: 21 May 2010
Posts: 2

PostPosted: Wed Jun 02, 2010 4:52 pm    Post subject: thanks Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Korzh.com developer tools Forum Index -> EasyQuery WinForms All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group