select in text

Stimulsoft Reports.NET discussion
Post Reply
ely
Posts: 4
Joined: Wed Jan 20, 2010 4:28 am

select in text

Post by ely »

Hi
I have a textbox in a databand whit datasourse x
I want this textbox's value be equal whit (if y select tb1.f1 else select tb2.f1)
Is it possible?
tanks
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

select in text

Post by Edward »

Hi

Yes, that is possible. Please write the following expression in Text property:

{Condition?tb1.f1:tb2.f1)

Thank you.
ely
Posts: 4
Joined: Wed Jan 20, 2010 4:28 am

select in text

Post by ely »

Hi and thanks Edward
I try your solution but it works just for first value,for example see:

table x:
f1
1
2

table t1:
f1 f2
1 100
2 200

table t2:
f1 f2
3 100
4 200

{x.f1>1?t1.f1:t2.f1}
but it always return t2.f1.
and one more thing: My text datasourse is table X.

:cry: and another question:I want one of my text's value={t1.f2*int.pars(Text1.Text)}
but the result is a message:"Expression in text property of 'Text2' can't be evaluated".I searched and found one like this the answer was to replace Text1.Text with a number
but I can't because Text1.text related to my condition(first question)
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

select in text

Post by Edward »

Hi

The reason why your condition did not work might be the fact that there are two different datasources were being used in one databand. So the second table was in the same position for all rendered with help of the databand rows.

And if you need to calculate several values which depend on each other, please use Dictionary Variables or assign values to text components in BeforePrintEvent of the DataBand to Text1.TextValue property.

Thank you.
Post Reply