unidatauniquery

How to select by elements in a UniData multivalued field


I'm trying to do an ad hoc search of records that contain duplicate values in the first and second elements of a multivalued UniData field. I was hoping something like this would work but I'm not having any luck.

LIST PERSON WITH EVAL "STATUS[1] = STATUS[2]"

After some testing it looks like I stumbled across a way of reading the field right to left that many characters. Interesting but not useful for what I need.

LIST PERSON NAME EVAL "NAME[3]" COL.HDG 'Last3'

PERSON Name  Last3
0001   Smith ith

Any ideas on how to correctly select on specific field elements?

Apparently the EXTRACT function will let me specify an element but I still can't get a selection on it to work properly.

LIST PERSON STATUS EVAL "EXTRACT(STATUS,1,2,0)" COL.HDG 'Status2'

PERSON STATUS    Status2
0001   Added     Processed
       Processed 

Solution

  • I would use eval with @RECORD placeholder with the dynamic array notation as such (assuming that STATUS is in Attribute 11.

    Edit: Previous answer was how I would do this in UniVerse

    SELECT PERSON WITH EVAL "@RECORD<11,1>" EQ EVAL "@RECORD<11,2>"
    

    Script Wolf's more better way that works in UniVerse and UniData.

    SELECT PERSON WITH EVAL "EXTRACT(@RECORD,11,1,0)" EQ EVAL "EXTRACT(@RECORD,11,2,0)"
    

    Good Luck.