Options

Anyone familiar with using Choose with a list?

N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
All the examples of Choose seems to reference a position ranking followed by the list (predefined). Can you build a date list for example and then reference the date list with choose? When I try to use choose on a date list it pulls back all the fields in the list.

Right now I am using a max sub select to reference the same table to create a dynamic max query to pull the latest date range. I was hoping choose could do this. Thanks!

Comments

  • Options
    NotHackingYouNotHackingYou Member Posts: 1,460 ■■■■■■■■□□
    I think you could use CHOOSE(@Pos, 'Date1','Date2',Date3') ?
    When you go the extra mile, there's no traffic.
  • Options
    N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
    I was hoping to reference the list
    choose(2,'DateList')
    A predefined list seems rather limited like for days of the week or months in a year. I was hoping you could nest an expression with choose to create a function.

    I tried casting the datelist to varchar and some other techniques. It reminds me of the choose in excel and just a limited
  • Options
    NotHackingYouNotHackingYou Member Posts: 1,460 ■■■■■■■■□□
    I can't seem to get CHOOSE to work with a subquery. You may have to make a UDF or SP that when called queries a table and builds up your params based on the # of results.
    When you go the extra mile, there's no traffic.
  • Options
    N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
    It seems to be very limited. O well I am moving on enough about CHOOSE lol.
Sign In or Register to comment.