LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: ann on December 20, 2017, 06:06:27 am

Title: if condition from datasource
Post by: ann on December 20, 2017, 06:06:27 am
Hi.
I would like to make condition from tablewidget from datasource.
I tried this coding but it did not work
$S{if($D{tablewidget.InStatus}=="2" {$D{tablewidget.In}}}

Besides that, can I change the color of table column in the condition too?

Thanks in advance.
Title: Re: if condition from datasource
Post by: Subst on December 20, 2017, 08:46:43 am
You try to use widget.

You can't use widget, must use the datasource that is needed to identify in limereport
Title: Re: if condition from datasource
Post by: ann on December 21, 2017, 06:30:48 am
Thanks for the reply, but I don't think the name(tablewidget) is an issue.
However, my problem solve. not sure what is the issue. but the following code works.

$D{tablewidget.In}
$D{detail.nextLine}
$S{
if($D{tablewidget.In} == "") {
THIS.fontColor=QColor('white')
setVariable("colourFlag","1");
}
else{
setVariable("colourFlag","0")
}
}

$S{if($D{tablewidget.InStatus}==2 && getVariable("colourFlag") == 0)
THIS.fontColor=QColor('green')
else if($D{tablewidget.InStatus}==3 && getVariable("colourFlag") == 0)
THIS.fontColor=QColor('red')
else if(getVariable("colourFlag") == 0)
THIS.fontColor=QColor('black')
}