Access Calculated Column via relation
Posted: Fri Jul 12, 2019 12:00 pm
Hello,
I have a basic report listing some information about Trees (just an ID and GlobalID at the moment). The report uses
tree information from two different databases using two different SQL Connections. One database contains a table
with basic information about trees and the second database contains the same information, but with a Condition
field added. The Condition field is a numeric field containing values from 1 to 100 with 100 meaning that the
tree is in excellent condition and 1 meaning the tree is in a "failed" state.
In order to give a descriptive meaning to the Condition values, I added a calculated field (called ConditionText) with
the following switch statement...
(string)Switch(
TreeData.Condition >= 80,"Excellent",
TreeData.Condition >= 60 && TreeData.Condition < 80,"Good",
TreeData.Condition >= 40 && TreeData.Condition < 60,"Fair",
TreeData.Condition >= 20 && TreeData.Condition < 40,"Poor",
TreeData.Condition < 20,"Failed")
I know I could use a CASE statement in the SQL code to accomplish the same thing as the switch statement, but
this is just a sample report. The real report I'm working with contains a DataTable datasource that I cannot edit - using
a calculated column is the only option I have.
On to my question/issue...
I have established a relation between the two databases in my report using the GlobalID from both the Trees and
TreesCondition tables.
I have added the following fields to my sample report...
DB1.AssetID, DB1.Globalid,DB1.relationtoDB2.GlobalID,DB1.relationtoDB2.Condition,DB1.relationtoDB2.ConditionText
All of the information displays properly except for the DB1.relationtoDB2.ConditionText field - it appears to only show
the ConditionText value from the first record that it comes across.
Is it possible to access a Calculated Column using a relation between two different databases from two different connections?
I've attached a sample report and databases for you to test with. I hope you can provide some direction, or confirm
that it is not possible to do what I'm trying.
I am currently using Stimulsoft.Reports 2018.1.8 from February 2018, ASP.NET, Flex.
Thank You,
Carl
I have a basic report listing some information about Trees (just an ID and GlobalID at the moment). The report uses
tree information from two different databases using two different SQL Connections. One database contains a table
with basic information about trees and the second database contains the same information, but with a Condition
field added. The Condition field is a numeric field containing values from 1 to 100 with 100 meaning that the
tree is in excellent condition and 1 meaning the tree is in a "failed" state.
In order to give a descriptive meaning to the Condition values, I added a calculated field (called ConditionText) with
the following switch statement...
(string)Switch(
TreeData.Condition >= 80,"Excellent",
TreeData.Condition >= 60 && TreeData.Condition < 80,"Good",
TreeData.Condition >= 40 && TreeData.Condition < 60,"Fair",
TreeData.Condition >= 20 && TreeData.Condition < 40,"Poor",
TreeData.Condition < 20,"Failed")
I know I could use a CASE statement in the SQL code to accomplish the same thing as the switch statement, but
this is just a sample report. The real report I'm working with contains a DataTable datasource that I cannot edit - using
a calculated column is the only option I have.
On to my question/issue...
I have established a relation between the two databases in my report using the GlobalID from both the Trees and
TreesCondition tables.
I have added the following fields to my sample report...
DB1.AssetID, DB1.Globalid,DB1.relationtoDB2.GlobalID,DB1.relationtoDB2.Condition,DB1.relationtoDB2.ConditionText
All of the information displays properly except for the DB1.relationtoDB2.ConditionText field - it appears to only show
the ConditionText value from the first record that it comes across.
Is it possible to access a Calculated Column using a relation between two different databases from two different connections?
I've attached a sample report and databases for you to test with. I hope you can provide some direction, or confirm
that it is not possible to do what I'm trying.
I am currently using Stimulsoft.Reports 2018.1.8 from February 2018, ASP.NET, Flex.
Thank You,
Carl