1

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?

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
Script Wolf
  • 106
  • 2
  • 12

2 Answers2

1

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.

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
  • Thanks for the suggestion, sorting on the field should help for some of the smaller files. It doesn't really help with my larger files though since I still have one value per record and some of my files have well over 1,000,000 records. – Script Wolf Aug 07 '17 at 14:26
1

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
Script Wolf
  • 106
  • 2
  • 12