Filter Item Table based on string?

Is it possible to filter a table based on a string?

using Item Table I need to filter No. by first 7 Chars.

So I did…

//Export Unique Web Parent Code
ParentCode := COPYSTR(“No.”, 1, 7);

from this I need to do a FINDSET for the items based ParentCode ?

Regards

P…

Depending on where you are doing this, something along the lines of;

CLEAR(ParentCode);

ParentCode := COPYSTR(“No.”,1,7);

Item.SETFILTER(“No.”,%1,ParentCode);

IF Item.FINDSET THEN…

I give this a go thanks…

as the item.No. field was

eg 1234567890 & parentcode would be 1234567 I didn’t think I could use SETFILTER

you wont be able to as you will potentially get more results than you want.

Create a local text variable, let’s call it Wildcard.

Wildcard has a value of * (just an asterisk)

Can you then define ParentCode1 to be CopyStr(Parentcode,Wildcard)

I think that should work…?

sorry Paddy, I should have asked a further question.

If you have items

1234567890, 1234567891, 1234567892

and you want to filter by the first seven characters, I take it you are expecting to find all three results when you filter with 1234567

If this is the case, then a filter with 1234567* would work.

Yes… this is what I’m expecting. based on the example all 3 records in my FINDSET.

from this I’ll be accessing the sales price file to check unit price difference

Kryton… Thanks for your time on this…

CLEAR(ParentCode);
ParentCode := COPYSTR(“No. 2”,1,7);
WildCard :=’*’;
ParentCode2 := COPYSTR(ParentCode,Wildcard);

This doesnt work I’m guessing as COPYSTR is expecting Postion,Length unless I’ve defined it wrong?

ParentCode & ParenCode2 are Code

Wildcard is Text.

Getting a conversion error integer := Text

I don’t understand?

won’t it always find everything if you just take the first 7 charaters in a string? Unless You have a field where you are entering the 7 digit string so the list has someting to compare against?

Say you are trying to filter the item list based on some string you enter.
Form31 Item List
Add a Variable “FilterString” Type Text 30
Add a Textbox to the bottom of the form (reminder:::Glue=Bottom) w/ sourceexp = FilterString

OnAfterValidate() of the FilterString TexBox
RESET;
SETFILTER(“No.”,’%1’,FilterString+’*’);
CurrForm.UPDATE;

Now if the Item List is is not editable, add to the textbox Triggers:
OnActivate()
CurrForm.EDITABLE(TRUE);
OnDeactivate()
CurrForm.EDITABLE(FALSE);

now type in a string and click on the form somewhere to accept the entry it should filter the list by your string.
Is this what you are looking for? Can you explain more your goal?

Thank You Savatage…

I was just unsure on how to filter the item table based on a string which I had from the No. field.

your SETFILTER line works fine for my goal

Regards

Paddy[:)]