Talked with one of the support person,
11:37 Your Question: Sorting on field with lookup value
11:37 Please wait and one of our operators will be with you shortly.
11:38 You are now chatting with xxx (Suporte Scriptcase)
11:38 Daniel Adinugroho: Hi xxx
11:38 Daniel Adinugroho: me again
11:39 Daniel Adinugroho: It was not work
11:39 xxx: Hello, Daniel
11:39 Daniel Adinugroho: below is the sql for lookup
11:39 Daniel Adinugroho: SELECT name
FROM category
WHERE id = {categoryFk}
ORDER BY name
11:39 Daniel Adinugroho: everytime I sort it always sort based on the categoryFk value
11:39 Daniel Adinugroho: when I tried to use JOIN, I got error message
11:40 Daniel Adinugroho: I mean join item and category
11:40 Daniel Adinugroho: SELECT i.id, i.code, i,name, c.name FROM item i INNER JOIN category c ON c.id = i.categoryFk
11:44 xxx: this SELECT is in which field?
11:48 Daniel Adinugroho: categoryFkc==>SELECT name
FROM category
WHERE id = {categoryFk}
ORDER BY name
11:48 Daniel Adinugroho: While this select is in SQL of the grid application ==> SELECT i.id, i.code, i,name, c.name FROM item i INNER JOIN category c ON c.id = i.categoryFk
11:49 xxx: ok, i’m making some tests
11:59 xxx: truth… the ordering is still made by id because it is the value that is registered in the field in the database
12:00 xxx: this ordering is done by the database
No solution yet, while this is I think the most simple and important thing to have.
Using this as basis SELECT i.id, i.code, i,name, c.name FROM item i INNER JOIN category c ON c.id = i.categoryFk, or for complete sql I used,
SELECT
i.id,
i.code,
i.name,
i.description,
baseUnit,
basePrice,
itemClass,
categoryFk,
i.status,
c.name
FROM
item i
JOIN
category c
ON c.id = i.categoryFk
I got this error message when sorting
Error while access the database
The other solution that I can think of is to create a new field, then use lookup based on the categoryFk but then this new created lookup does not appear in sorting.
Any ideas?