TableSelect Maths

Discuss your general Proclaim related queries here.
Post Reply
JamieP
Posts: 3
Joined: Fri Aug 17, 2018 3:47 pm
Has thanked: 1 time

TableSelect Maths

Post by JamieP » Fri Jun 28, 2019 2:46 pm

Hi, i'm pretty new to working within tables so I may be going about this the wrong way but if anybody can offer advice that would be great.
I want to select all correspondents in a table but based on a few fields ie...

TABLESELECT( {testtable.Table} WHERE {code1.Code} = "Yes" AND {code2.code} = "Pri" AND {code3.Code} = "CL1" )

The above works fine, problem is I also want an OR for the end part i.e. {code3.Code} = "CL1" OR {code3.Code} = "CLTEST"

Can it all be done from one tableselect or
can I do another tableselect within the results of the first tableselect, if so how would I go about this?

Thanks for any help,

Jamie

revellbikes
Posts: 437
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 12 times
Been thanked: 44 times

Re: TableSelect Maths

Post by revellbikes » Wed Jul 03, 2019 1:03 pm

I think I know what you mean, you can't do multiple TABLESELECT's in a row as it won't retrieve anything from an already filtered view. You'd need to do your AND's first then your OR's on a separate TABLESELECT line I think?

So to overcome this I'd probably add a new column to your table, called "Selected" or something. Then do your first TABLESELECT, cycle through each of the lines and add in 'Yes' to the selected lines, TABLERESET then do your second TABLESELECT and mark them aswell.

Finally do a TABLESELECT for you 'Selected' column.

Do what you need to do with the data then cycle through the whole table and set the selected column back to blank / no or whatever you decide upon.

I think that should work? Unless I've not understood your requirements exactly :)

JamieP
Posts: 3
Joined: Fri Aug 17, 2018 3:47 pm
Has thanked: 1 time

Re: TableSelect Maths

Post by JamieP » Mon Jul 08, 2019 4:45 pm

Great thank you, will give that a try. Thanks for the help :)

revellbikes
Posts: 437
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 12 times
Been thanked: 44 times

Re: TableSelect Maths

Post by revellbikes » Tue Jul 09, 2019 10:34 am

No problem!

It's probably worth saying at this point that you're opening yourself up to a world of pain. The documentation as you've probably found out is nonexistent when it comes to tables, Eclipse themselves don't seem to have a good grasp on when to use each command.

So let me know if you're struggling to get the results you need

JamieP
Posts: 3
Joined: Fri Aug 17, 2018 3:47 pm
Has thanked: 1 time

Re: TableSelect Maths

Post by JamieP » Fri Jul 12, 2019 11:35 am

Hi revelbikes,

Thanks again for your assistance, worked perfectly looping through the AND's adding a 'selected' field, then re-doing it for the OR's. :)
You're right, the documentation is pretty minimal on tables!

Post Reply