synergy46

SQL in Data View works... Same code in script-- not

Discussion created by synergy46 on Jan 27, 2014
Latest reply on Jan 28, 2014 by erolst

I am using FM 13 Advanced

 

I am admittedly new to sql. But, I need the 'distinct' function so I am giving it a go.

 

I dloaded sqlexplorer and use the resulting code in the script below.

Script purpose: I run a report which has a 'Filter' popup on it with Category choices.

When a choice is made, the report if filtered by that choice. One person may

be listed more than once. The report works.

 

labels1.png

What I am trying to do is to print Avery 5160 labels that show JUST ONE
PERSON no matter how many times they are listed.

(Fred Flintstone is listed TWICE)

 

To that end I created a SQL query that, when pasted into the Data View

shows the desired results.

 

However, when I run the same code in ExecuteSQL I get duplicated

names.

 

The selected Category is held in $$MnuSelection. I have tried changing

the SQL parameter to "$$MnuSelection" and $$MnuSelection and it fails

both times in the code below

 

What am I missing???

 

Thanks

 

Ron

sql1of2.png

sql2of2.png

Outcomes