Hello All,
I have a problem in that if i have a range of Itemcodes from "1000 to 9000" for example.
Now on a form say a user enters "1170" in a text box.I want to be able to collect all Itemcodes that have "11" as the start of the code.So these would be "1110,1120,1135,1148" etc and it must then populate the relevant fields.
Can this be done?
Here is an attempt by me
IF ItemCode <> '' THEN BEGIN //ItemCode is the source expr'sion of TB
NewItemCode:= ItemCode;
INIT;
NewItemCode:=DELSTR(ItemCode,3,2);
//sam:= STRPOS(ItemCode,NewItemCode); found this by using f1
// Item.SETFILTER("No.",'<=%1',ItemCode); this evrything below 1170
IF Item.FIND('-') THEN
REPEAT
IF FirstPos=SecondPos THEN BEGIN
"Table Entry No.":=NextEntryNo;
"Item No.":=Item."No.";
"Old price":=Item."Unit Cost";
Item.CALCFIELDS(Inventory);
Quantity := Item.Inventory ;
"Person Amending" := USERID;
INSERT;
NextEntryNo:= NextEntryNo +1;
END;
UNTIL Item.NEXT=0;
END;
thanks for the help
Regards
Five :?
Compile and then Recompile ....
0
Comments
IF (COPYSTR(ItemCode,1,2)) = '11' THEN
WhateverYouWantToDo;
I don't know if I understand your issue completely but it seems that this should work.
Item.SETFILTER(Code,'%1',COPYSTR(NewItemCode,1,2) + '*');
Item.FIND('-');
This should only get the records whose code starts with the first two digits of the NewItemCode, and filter out the rest. If you don't want the user to release the set filter the use filtergroups to filter out all the other records.
Cheers
Five