19
Views
6
Comments
Advanced Query and List_SortColumn error
Question
I'm using an advanced query with a List_SortColumn, my default search is working fine, but when I try to sort on other columns I'm getting a query where I get something like "{CONTACT}.[Name] ASC ASC".  Because of the extra "ASC" in the value being returned back I get a query error.  Is there something I'm missing on using the List_SortColumn or do I need to manually strip out the second "ASC"?  I am using version 7.  Thanks!
2011-06-15 10-49-56
AcacioPN
Staff
Hi Rebecca

If you are getting a second ASC it is probably because you are putting the sort condition on the columns as "COLUMN_NAME ASC".

When using the sort widget you only need to provide the column name. ASC or DESC is set automatically depending on the number of times you click the column - once for ASC, twice for DESC, again for ASC, etc.

If this does not work for you you can upload the OML file here so that I can take a look at it.

Cheers,
Acácio

2018-06-01 14-37-59
Rebecca Hall
I'm not using any "ASC" in either the widgets or the advanced query.  On the sort widgets the text is like "{CONTACT}.[Name]"
2011-06-15 10-49-56
AcacioPN
Staff
Hi Rebecca

Can you post the eSpace (or just put copy-paste the affected screen to a separate eSpace) so that I can take a look?

Acácio
2018-06-01 14-37-59
Rebecca Hall
This is the most complex column sort:  List_SortColumn_GetOrderBy(MachineTableRecords.Id, "{MACHINE}.[MachineCode}, {PURCHASE_TYPE}.[Order]")

This is the query:

SELECT {INVESTMENT_MACHINE}.*,
    {MACHINE}.*,
    {SUPPLIER}.*,
    {SUPPLIER_LINE_STATUS}.*,
    {PURCHASE_TYPE}.*,
    scheduledate.[PlannedDate],
    scheduledate2.[PlannedDate]
FROM {INVESTMENT_MACHINE}
    Left Join {MACHINE} on {INVESTMENT_MACHINE}.[MachineId] = {MACHINE}.[Id]
    left join {SUPPLIER} on {INVESTMENT_MACHINE}.[AwardedSupplierId] = {SUPPLIER}.[Id]
    Left Join {SUPPLIER_LINE_STATUS} on {INVESTMENT_MACHINE}.[SupplierLineStatusId] = {SUPPLIER_LINE_STATUS}.[Id]
    Left Join {PURCHASE_TYPE} on {INVESTMENT_MACHINE}.[PurchaseTypeId] = {PURCHASE_TYPE}.[Id]
    Left Join (SELECT {INVESTMENT_MACHINE_DATE}.* FROM {INVESTMENT_MACHINE_DATE}) scheduledate on 
            ({INVESTMENT_MACHINE}.[Id] = scheduledate.[InvestmentMachineId] and scheduledate.[ScheduleTypeId] = @ScheduleTypeId)
    Left Join (SELECT {INVESTMENT_MACHINE_DATE}.* FROM {INVESTMENT_MACHINE_DATE}) scheduledate2 on 
            ({INVESTMENT_MACHINE}.[Id] = scheduledate2.[InvestmentMachineId] and scheduledate2.[ScheduleTypeId] = @ScheduleTypeId2)
WHERE {INVESTMENT_MACHINE}.[InvestmentId] = @InvestmentId
@OrderBy
2018-06-01 14-37-59
Rebecca Hall
This is what I'm seeing in the debugger: 
2012-03-16 12-21-09
João Rosado
Staff
Hi Rebecca,

Check the order by blocks in the header of your table. They should not contain the "ASC" word, or try to call get order to do multiple order rules.

Regards,
João Rosado
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.