Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort List boxes

Hi Guys

I have a list box with dates on it, there are dates in the past present and future, I wish to default the first displayed date as Today -5,

Can this be done ?

Thanks,


A

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    You can easily play with the expression and achieve this. The same expression which i have posted can be used according to your requirement.

    just need to change 1, 2, 3...... according to the order of the date.

   Compare the date you want at first and give 1 no to it and same for others.

Regards,

Kaushik Solanki  

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

11 Replies
Not applicable
Author

hi,

Right click on list box and so to sort tab select expression and type

if(date(listboxname)=date(today()-5), listboxname)

Sumit

Not applicable
Author

Hi Sumit

I can not get it to work,

The List Box is based on a Cyclic Group called Date Group , I have changed it to Date field and tried

if(date(Date)=date(today()-5), Date)

But I am afraid this does not work either , perhaps you could help

Thanks

A

erichshiino
Partner - Master
Partner - Master

Hi,

Try this:

if ( num([Date Group]) = num(today())-5,[Date Group])

Hope this helps,

Erich

Not applicable
Author

Hi Erich,

I was away for awhile, the above is very helpful, but that just brings the date 5 days ago to the top of the list box, at the moment it looks like this

DATE GROUP

1/03/11

2/03/11

3/03/11 etc etc etc

20/08/11

21/08/11

I wish for the last 5 days to be top of the list box, so today is the 23/08/11 so,

DATE GROUP

18/08/11

19/08/11

20/08/11

21/08/11

22/08/11

1/03/11

2/03/11 Etc etc

Is this possible ?

Thanks

A

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try this in sort tab.

    Check Expression and type

   

    if ( num([Date Group]) = num(today())-5,1,2)

    Uncheck every other sort options.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

This is giving me - the date 5 days ago plus the date 4 days ago, see below

DATE GROUP

18/08/11

19/08/11

1/03/11

2/03/11 Etc etc

I have tried to amend yourexpression to if ( num([Date Group]) = num(today())-5,1,2,3,4,5) to get all 5 dates but it is not working , can you help, perhaps I am doing some

erichshiino
Partner - Master
Partner - Master

Hi,

Try this then:

if ( num([Date Group]) <= num(today())-5, num ( [Date Group]),num ( [Date Group])*1000 )

The if condition will just create weights to the two sets of dates

Hope this helps,

Erich

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try this.

    if ( num([Date Group]) = num(today())-5,1,

    if ( num([Date Group]) = num(today())-4,2,

    if ( num([Date Group]) = num(today())-3,3,

    if ( num([Date Group]) = num(today())-2,4,

    if ( num([Date Group]) = num(today())-1,5)))))

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Im really sorry guys this just does not seem to work, for Erich solution there is no change to the order 9 I have put in sort tab, ticked expression and pasted in)

For Kaushik, I cant quite figure out what I am getting , the following is the result,

Date.bmp

The 7/03/11 is the First calander date !! i would have liked it to be

Date

17/08/11

18/8/11

19/8/11

22/8/11

23/8/11

7/03/11

8/3/11

etc etc

Thanks guys