Training and Education > U2 Programming Questions

BY-EXP and WHEN

(1/1)

DonQuixote:
I'm using UniData and I'm trying to select a specific range within a multiValue field.
WHEN is not available in my SELECT statement.
BY-EXP field                               works   
BY-EXP  fname  =  "value"           works just like a WHEN would
BY-EXP  fname  >=  "value"         results in the error "too many values/subvalues in one field"

I need to use  ( >= )  and  (  <=  )
Any Ideas?

Example:
SELECT BOOKINGS.LINE BY-EXP UPD.DATE >= "01/01/16"






Tom Pellitieri:
In UniData, WHEN is only available for LIST and SORT commands, and then only in ECLTYPE U.  SB+ typically requires ECLTYPE P, so be cautious when using this.

The BY-EXP is used when SORTING items, not strictly selecting. 

You should be able to do something like this:

SELECT BOOKINGS.LINE WITH UPD.DATE >= "01/01/16" AND WITH UPD.DATE <= "01/31/16"
sort BOOKINGS.LINE BY-EXP UPD.DATE WHEN UPD.DATE >= "01/01/16" AND UPD.DATE <= "1/31/16" UPD.DATE

Note that the lower case "sort" forces ECLTYPE U.  Also, this works for TCL, and probably won't work in SB+ Selection Criteria (e.g., /RD).

For what it's worth, our BOOKINGS.LINE file doesn't have more than one value in UPD.DATE.

Navigation

[0] Message Index

Go to full version