Susanne
4th November 2005, 13:24
Is it possible to use index in Easy-sql.
mark_h
4th November 2005, 15:58
In what way?
This is one of my queries:
select tpppc235.cprj, tpppc235.cspa, tpppc235.task, tpppc235.sern
from tpppc235
where tpppc235._index1 = {" 5483"}
I normally just type my query in and I am not sure you can go through the screens to get to the index.
HennySol
6th November 2005, 22:22
It depends. In versions upto B4c4 the index used is always the first index. Just to be sure: enter the code Mark entered and see if Baan reports a problem. If Baan does the conclusion is: in your Baan version using the ._index* is not allowed. Baan will use the first index! Remember this when you design your query. If Baan does not report a problem: be happy and enjoy and use it to optimize your query
Susanne
7th November 2005, 10:18
It works in our old Baan IV b2. :)
HennySol
7th November 2005, 10:39
I'm not surprised. I did remember that it used to work once but forgot the exact version. You could try to report it as a bug to Baan but I would be surprised if they agree to fix it. Best solution is - I fear - design your query in such a way that it performs rapidly on the first index and try to move the more complex things to the report (sorting, reading related tables etc). There is -as far as I know- no alternative.
Susanne
7th November 2005, 14:50
hmhm -
Can i use both index and to tables in same query ?
Hitesh Shah
7th November 2005, 14:56
Indices will not be generated automatically .
U can write any indices manually with logical operators including combined ones with # .
Indices will not work with inrange specification .
U can not use Easy SQL option after writing the index in SQL query .
Susanne
7th November 2005, 15:34
select
tfacp200.ninv, | Dokument
tfacp200.orno, | Indk.ordre
tfacp200.suno, | Leverandør
tfacp200.tpay, | Dokumenttype
tfacp200.stap, | Fakturastatus
tccom020.nama | Navn
from
tccom020, | Leverandører
tfacp200 | Open Items (Purchase Invoices & Payments
)
where
tfacp200.stap >= tfacp200.stap.f and
tfacp200.stap <= tfacp200.stap.t and
tfacp200.orno >= tfacp200.orno.f and
tfacp200.orno <= tfacp200.orno.t and
tfacp200.suno >= tfacp200.suno.f and
tfacp200.suno <= tfacp200.suno.t and
tfacp200.suno = tccom020.suno and
tfacp200.tpay = tfacp.tpay.invoice
order by
tfacp200.suno,
tfacp200.orno
this is my sql, and instead of order by I would like to use index2 to
Hitesh Shah
7th November 2005, 18:32
As suggested by hennysol , u should do the sorting in the report by keeping the sort order ascending .
If u know want only 1 supplier , u can use the index2 (of which 1st element is supplier , correct me if wrong) like following in where condition.
tfacp200._index2 = {"ABCDEF"}
U should be able to use order by tfcp200._index2 if u have all the index2 fields selected in the select list . I would still stick to not using order by clause in SQL.
Susanne
8th November 2005, 08:43
I got error messages all the time :mad:
It only works with mark_h suggestion ;)