1

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

1 Answers1

2

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.

Van Amburg
  • 1,207
  • 9
  • 15
  • This is throwing a strange error and pointing at the comma. The error message is "Virtual Attribute Error: qz1zq syntax error". The only thing I could find on this error is that you can't use the dynamic array notation, <> and that instead you should put it inside an EXTRACT. – Script Wolf Oct 05 '18 at 14:34
  • That did the trick! The syntax I needed was: SELECT PERSON WITH EVAL "EXTRACT(@RECORD,11,1,0)" EQ EVAL "EXTRACT(@RECORD,11,2,0)" – Script Wolf Oct 05 '18 at 14:43
  • Might be a UniData vs UniVerse difference. I will update my answer to denote this. – Van Amburg Oct 05 '18 at 18:13