Reminders

Sorting Date Columns

2 years ago
OfflineTheunis Viljoen
Theunis Viljoen

Dear all,

I wonder whether anyone may be able to give some advice here.

I have set up a report as follows:

The months in the 'Key month' drop-down object is a timerange driven from the year box and the months in the column header are the values of the 'Key Month' drop down. I then want to sort the table based on the Key Month selection - e.g. if Jul is selected the table values should be sorted based on the values in the Jul Column.

I then add a 'sort' link as follows:

But the result is then as follows:

As you can see, it actually restricts the values to Jul (hides other months) and certainly does not perform a sort.

I then had a look at the SQL statement:

SELECT SUM(T00.`Amount`), T00.`DETAIL` FROM `RawData` T00 WHERE T00.`PAYMENT DATE` BETWEEN {d '2010-07-01'} AND {d '2010-07-31'} AND T00.`DETAIL` IN ('Advertising Recharge', 'Barstocks (Spirits Etc)', 'Bin Collection', 'Book Of Remembrance Costs', 'Clinical & Medical Waste', 'Communications', 'Computer Hardware Maintenance', 'Computer Software Maintenance', 'Contracted Services', 'Country Grounds', 'Credit Card Recharge', 'Dayworks/Miscellaneous', 'Decoration', 'Derv.', 'Disposal Cost Architect', 'Donations', 'Electricity Direct Invoices', 'Entertainment Percentage Shows', 'Equipment') AND T00.`PAYMENT DATE` BETWEEN {d '2010-01-01'} AND {d '2010-01-31'} GROUP BY T00.`DETAIL` ORDER BY 2 ASC

and it is clear that it is adding a 'Jul' filter for each month.

What am I doing wrong here....?

Regards

 

-----
You liked this too0 people like this discussion.
 
Concluded

1 Conclusion:

OfflineAju Mathew Aju Mathew said 2 years ago

Hi Theunis,

As per your request here is a screenshot of the example. OF you can't make out the formula in the screenshot then here it is

SORT ( REFERENCE ( [<DataTable>] ; SETTING ( [<MonthMenu>] ) ; 1 ; SETTING ( [<MonthMenu>] ) ; LAST ) ; ASCENDING ; [<DataTable>] )







Last edited by Tasso Henke - 6 months ago

7 Replies

OfflineAju Mathew Aju Mathew said 2 years ago

Hello Theunis,

Instead of doing the Sort using the dragging arrow, I suggest you use the sort function to sort the Table based on the column of the month. Put this formula on the switch event of the Month menu and Based on the setting of the menu you can detrmine which column to base the sort on.

Hope that helps.

Best regards,

Aju Mathew


OfflineAju Mathew Aju Mathew said 2 years ago

Hi Theunis,

As per your request here is a screenshot of the example. OF you can't make out the formula in the screenshot then here it is

SORT ( REFERENCE ( [<DataTable>] ; SETTING ( [<MonthMenu>] ) ; 1 ; SETTING ( [<MonthMenu>] ) ; LAST ) ; ASCENDING ; [<DataTable>] )








OfflineTheunis Viljoen Theunis Viljoen said 2 years ago

Thank you very much Aju - works like a dream!

Regards

Theunis


OfflineAzira Hussain Azira Hussain said 16 months ago

Help! help! I'm an Arcplan beginner. I have problem in date sorting. my date sorting only sort day and month NOT including the  Year. E:g-

DateSorting2.png

I'm using <Tarikh Keluar> button as a control.

Hope the expertise here can help me..

 

Thanks a lot.

Regards;

Zira

 


OfflineJürgen Günther Jürgen Günther said 14 months ago

looks like it sorts the "string" but not the real value.

Try to transform it on the database or in arcplan to int in a second column in the format yyyymmdd and sort by that column instead of the date column


OfflineJürgen Günther Jürgen Günther said 14 months ago

you can use SQL-Function datepart to workaround this. Pls note that you may have internationally different type of display date as well (have to mention: arcplan has loads of problems concerning localizition beyond engl / german)


Would you like to comment?

You must be a member. Sign In if you are already a member.

  • 794 views
  • 1 version
  • 7 replies
  • 2 followers
     
Post Date:
August 6, 2010
Posted By:
Theunis Viljoen
 

Related Content

Search this area

About this forum

  • 24,973 views
  • 96 topics
  • 7 followers
     

Viewed 794 times