
Highest of messing up a previous selection
Highest of messing up a previous selection
I have a procedure that selects data, creates a report and exports it:
for joborders with (closed = 0 OR closed =blank ) ;
--Some calculations here
for production with ( phase = 10 AND stb not = "1" );
--Other calculations here
end
list records
Customer in order;
--Others fields here
end
export to "c:\tmp\mydata.txt" .
--export functions here
The reports has been using for months now and it works as expected.
I have now to add in the report a new column, so modify the procedure as follows:
for joborders with (closed = 0 OR closed =blank ) ;
--Some calculations here
tFase := highest of production with tsb = "1" phase . --That is the difference from the code above
for production with ( phase = 10 AND stb not = "1" );
--Other calculations here
end
list records
Customer in order;
--Others fields here
end
export to "c:\tmp\mydata.txt" .
--export functions here
The problem is that the second procedures selects and exports more data than the first one (290 vs 150 lines).
Any ideas or suggestion?
Re:Highest of messing up a previous selection
The result of any selection/filter etc, in DataEase is a MultiView i.e. a Data-Set that contain all the columns and rows of the selection you query.
As a relational database everything is also relationships. Any Script, Table Definition, Relations Ship definition etc, is basically just info to DataEase about what to do in real time.
So a relationship defined in the Relationship table is no different than the ad-hock relationship defined in a DQL etc.
DataEase is a "quick start" tool that allow you to do a lot of stuff that programmers would never do like allowing column names with extended characters and spaces etc, as well as defaulting relationship names to table names.
When you work on a table you do in reality work on a relationship.
So Production when used in Highest of Production is not the highest value in the table Production but the highest value in the relationship Production. So if there is a relationship between joborders and production, you have already limited your scope.
So if you add filters to the relationship you will narrow it more and more.
When you use highest of production with tsb=1 you have added another constraint to the relationship Production.
So when you then do For Production with (phase=10 and stb not="1") you do in reality For Production with (Phase=10 and stb not="1" and tsb="1) if you think of it as a Table.
This is why you have alternative relationship names and in an ideal world DataEase would force you to use one and that it was different to the table name.
tFase := highest of production named "PhaseRel" with tsb = "1" phase .
http://www.dataease.com/dg3_HelpView/?PageID=12097&field1=*Named*
Re:Re:Highest of messing up a previous selection
Thanks for the tip, it worked.
Re:Re:Re:Highest of messing up a previous selection
Glad it did.
Sorry for the long lecture, this forum is part of the "documentation" which we will soon publish so we try to give as extensive answers as possible so future generation will get something out of it too ;-)