Easy to Create, Easy to Change - Easy to use!


Highest of messing up a previous selection


Started by George Washington
Search
You will need to Sign In to be able to add or comment on the forum!

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?

Written by George Washington 14/01/15 at 09:06:00 Dataease [{8}]FIVE

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*

Written by DataEase 14/01/15 at 10:35:33 Dataease [{8}]FIVE

Re:Re:Highest of messing up a previous selection

Thanks for the tip, it worked.

Written by George Washington 14/01/15 at 10:53:34 Dataease [{8}]FIVE

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 ;-)

Written by DataEase 14/01/15 at 11:01:00 Dataease [{8}]FIVE