Using Lawson Office Addins Index Range as a Wildcard

One my biggest frustrations with using Lawson Office Addins Query Wizard is that the Index Key sets are hard to use.  I could never use them until I figured out that you have to define every index in order.  You can't skip one or else it won't work.  But there are large performance gains that can be found by using indexes that can make your Lawson Reporting more efficient.

Here is an example situation:

I want to look for employees in a specific department.  Process level doesn't matter.

From the EMPLOYEE table, I see EMPSET2 is:

COMPANY
PROCESS-LEVEL
DEPARTMENT
EMPLOYEE

I can't just do this:

COMPANY                    1
PROCESS-LEVEL     
DEPARTMENT             1001
EMPLOYEE

It doesn't work at all.  I get some stuff back, but it definitely doesn't match my query.

So you might be saying, why not just put a wildcard in there for PROCESS-LEVEL.  However, there really isn't a wildcard character.

One thing I do know is that ranges work.  And really, the function of a wildcard is really just an infinitely big range.  So let's run with that.  Why don't we just pick a sufficiently large range for one of the inner indices.

Let's use the same example:
I want to pull all employees in our HR company that are in any process level, but a specific department.

From the EMPLOYEE table, I see EMPSET2 is:

COMPANY
PROCESS-LEVEL
DEPARTMENT
EMPLOYEE

We learned that we need a wildcard for PROCESS-LEVEL, but a specific value for DEPARTMENT.

Well, to do a range in the Query Wizard, you use the little arrow thing with a dash and a greater than sign, like this:

->

So if I know that all my PROCESS-LEVELs are between 00 and 99, I can just set up the indices like this:

COMPANY                      1
PROCESS-LEVEL        00->99
DEPARTMENT               1001
EMPLOYEE

The 00->99 effectively acts as a wildcard, because you know with your system, that there won't be any higher or lower.  I think you can see how to apply this to pretty much any situation.

If the field is a character field, it gets a little trickier, but you can figure it out.  Its hard to figure out what the values of characters are.  It actually depends on the database behind the scenes.  However, a little testing can get you there.

Usually, numbers are a lower value than alpha characters.  And sometimes, special characters like _, or even *, or just a blank space, have certain values.  See an example of an ASCII table.  But, this ASCII table doesn't represent the specific ASCII table of values that you particular database is using.  I actually had a ticket with Lawson on this issue that opened my eyes up to this.

So anyways, sorry to be rambling on.  But if you had an alpha field that you wanted to emulate a wildcard using a range, you could do this:

000000->ZZZZZZ

And date fields can be done using a similar philosophy, but you have to use a different format for the year, yyyymmdd.  You can pick a magic date like 1/1/1970 to 1/1/2020 and do something like this.

19700101->20200101

So really, now that we know how to use indices better, Lawson Reporting using the Micorosft Office Addins is just a little easier.