Script Wolf
Script Wolf

Reputation: 106

Show UniData SELECT results that are not record keys

I'm looking over some UniData fields for distinct values but I'm hoping to find a simpler way of doing it. The values aren't keys to anything so right now I'm selecting the records I'm interested in and selecting the data I need with SAVING UNIQUE. The problem is, in order to see what I have all I know to do is save it out to a savedlist and then read through the savedlist file I created.

Is there a way to see the contents of a select without running it against a file?

Upvotes: 1

Views: 1005

Answers (2)

Script Wolf
Script Wolf

Reputation: 106

I don't know why I didn't think of it at the time but I basically needed something like SQL's DISTINCT statement since I just needed to view the unique values. Replicating DISTINCT in UniData is explained here, https://forum.precisonline.com/index.php?topic=318.0.

The trick is to sort on the values using BY, get a single unique value of each using BREAK-ON, and then suppress everything except those unique values using DET-SUP.

LIST BUILDINGS BY CITY BREAK-ON CITY DET-SUP
CITY.............
Albuquerque
Arlington
Ashland
Clinton
Franklin
Greenville
Madison
Milton
Springfield
Washington

Upvotes: 1

Dan McGrath
Dan McGrath

Reputation: 42046

If you are just wanted to visually look over the data, use LIST instead of SELECT.

The general syntax of the command is something like:

LIST filename WITH [criteria] [sort] [attributes | ALL]

So let's say you have a table called questions and want to look over all the author for questions that used the tag unidata. Your query might look something like:

LIST questions WITH tag = "unidata" BY author author

Note: The second author isn't a mistake, it's the start of the list of attributes you want displayed - in this case just author, but you might want the record id as well, so you could do @ID author instead. Or just do ALL to display everything in each record.

I did BY author here as it will make spotting uniques easier, but you can also use other query features like BREAK.ON to help here as well.

Upvotes: 1

Related Questions