Put the contents of the field you want to compare to in a variable, then use 
the variable instead of the field in the query.

HTH

Regards
Lutz

-----Ursprüngliche Nachricht-----
Von: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] Im Auftrag von Jim Medlen 
via 4D_Tech
Gesendet: Mittwoch, 24. Juli 2019 22:29
An: 4d_tech@lists.4d.com
Cc: Jim Medlen <j.med...@functionaldevices.com>
Betreff: Query by Formula Join vs. Comparison


I am trying to do a Query Selection By Formula that links two tables by the 
filed ItemNum with the condition that the value of a field in the first table 
does not equal a value in the second table.

When I look at the ResultPlan there is a Join on the Price fields even when I 
used the # comparison.

How do I define a comparison vs a join ?


C_TEXT($vResultPlan;$vResultPath)
DESCRIBE QUERY EXECUTION(True) //analysis mode

Query Selection by Formula([ItemDiscounts];\ ( 
([ItemDiscounts]ItemNum=[Items]ItemNum) \ & 
([ItemDiscounts]BasePrice#[Items]PriceB) \ & ([Items]PriceA#0)))

$vResultPlan:=Get last query plan(Description in text format)
ConsoleMessage("vResultPlan\r"+$vResultPlan)
$vResultPath:=Get last query path(Description in text format)
ConsoleMessage("vResultPath\r"+$vResultPath)

DESCRIBE QUERY EXECUTION(False) //End of analysis mode


vResultPlan
Join on Table : Items  :  ItemDiscounts.ItemNum = Items.ItemNum & 
ItemDiscounts.BasePrice = Items.PriceB
        Items.PriceA != 0
vResultPath
    Join on Table : Items  :  ItemDiscounts.ItemNum = Items.ItemNum & 
ItemDiscounts.BasePrice = Items.PriceB
                    Items.PriceA != 0   (3247 records found in 4 ms)
    --> 4030 records found in 22 ms
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to