Filtering Boolean become Option type

hi all. how to filtering field from boolean to option type
Group is option type (Male,Female,Both)
like for example

Table A
No. Name Group
1 Jon Male
2 Jack Both
3 Kim Female

Table B
No. Name Group
1 Jon Male
2 Kim Female

i want to filter table A group using table B group
in table C it should be only group Male & Female only
how is it?

my code
IF CLE.“Male” = TRUE THEN
TableB.SETRANGE(TableB.“Group”,TableB.“Group”::Male);
IF CLE.“Female” = TRUE THEN
TableB.SETRANGE(TableB.“Group”,TableB.“Group”::Female);
IF CLE.“Both” = TRUE THEN
TableB.SETRANGE(TableB.“Group”,TableB.“Group”::Both);

it only filtering the first only :frowning:

What exactly does above mean?

In above TRUE (Instead of CLE.“Male” = TRUE,just use CLE.“Male”) is not required, but that should not create problem/ error. Is CLE your table C? Where is the use of Table A in this code?

Table A has field like

Male (Boolean)

Female (Boolean)

Both (Boolean)

Table B Has One field Option (Male,Female,Both)

Table C Has One field Option (Male,Female,Both)

1 record table A = many records table B

so if table A tick the male and female, and table B consist of Male,Female,Both… it should be Male,Female in table C

Hi Stan,

Your if condition works in which way???

i mean in Repeat…untill loop or OnAfterGetRecord or where you are using it…???

i’m using repeat loop

REPEAT
TableC.RESET;
TableC.SETRANGE(“Document No.”, DtldCustLedgEntry.“Document No.”);
TableC.SETRANGE(TableC.Type,TableC.Type::Item);
IF CLE.“Male” = TRUE THEN
TableC.SETRANGE(TableC.“Group”,TableC.“Matrix Group”::Male)
ELSE IF CLE.“Female” = TRUE THEN
TableC.SETRANGE(TableC.“Group”,TableC.“Matrix Group”::Female)
ELSE IF CLE.“Both” = TRUE THEN
TableC.SETRANGE(TableC.“Group”,TableC.“Matrix Group”::Both)
IF TableC.FIND(’-’) THEN
InsertData;
UNTIL TableC.NEXT =0;

Hi stan,

your filter depends on CLE table’s boolean field…right??

How the CLE table is being sorted or filtered before using here??? because, there is nothing related to that except the if condtions…!!!

CLE table is already filter

CLE.SETRANGE(CLE.“Entry No.”,IPT.“Cust. Ledger Entry No.”);

if cle.find(’-’) then

My privious code

So CLE is already got 1 record

It means, CLE table is filtered by entry no., but you put repeat until loot for TableC.

I think its just about one or two lines that may be misplaced or missing in code…!!!

yap…

for example the boolean only Male,Female

after i filter… it only appear one of them :frowning:

Hi stan,

See whether is it useful or not… because i think some problem in filter…

CLE.SETRANGE(“Entry No.”,YourFilter);

if CLE.findfirst / (’-’) then repeat

TableC.reset;

TableC.SETRANGE(“Dcoument No.”,FIlter);

TabelC.SETRANGE(AnotherFilter);

if CLE.MALE then

TableC.SETRANGE(Group,TableC.GROUP::Male)

else if CLE.FEMALE then

TableC.SETRANGE(Group,TableC.GROUP:::Female)

else if both…

if TableC.findfirst then

InsertData;

until CLE.next=0; // you have put TableC.next=0…!!

if TableC.findfirst then

InsertData;

until CLE.next=0; // you have put TableC.next=0…!!

why until CLE.next=0; ?? i thought cle is just 1 record

If CLE is just one record and there are no more records in that, then you will have only one condition i.e. either male or Female or both…!!!

ok i will try first

thanks :slight_smile: