If ItemVarient.findset then
repeat
String := COPYSTR(ItemVarient.Code, 1, 1);
CASE String OF
'1' : BEGIN
Newtab.init;
Newtab.code := '1';
Newtab.value := 'Black';
IF Newtab.inset THEN;
END;
END;
until ItemVarient.next = 0;
I take it the records do not have the values you want to output stored on a field on the record?
I'm not really sure why you would want to do this but I don't know the context. You code do something like this, where Code var is just representing the record (I assume it's PK) -> get the 1st char -> hardcode the values in a case.
I don't really like this solution but a part of it might help. I would prefer to have the values on the record or linked in another table etc.
Code := '100';
String := COPYSTR(Code, 1, 1);
CASE String OF
'1' :
MESSAGE('Example');
The Code var is indeed a record and the values too need to get linked to a table.
Basically we have a record from Item Variant table. Then based on 1st number, the record need to be converted/formated to, lets say Colour (1 = black, 2 = white etc), then this colour will be inserted to a different table.... So this new table will act as a translator.
If ItemVarient.findset then
repeat
String := COPYSTR(ItemVarient.Code, 1, 1);
CASE String OF
'1' : BEGIN
Newtab.init;
Newtab.code := '1';
Newtab.value := 'Black';
IF Newtab.inset THEN;
END;
END;
until ItemVarient.next = 0;
Answers
I take it the records do not have the values you want to output stored on a field on the record?
I'm not really sure why you would want to do this but I don't know the context. You code do something like this, where Code var is just representing the record (I assume it's PK) -> get the 1st char -> hardcode the values in a case.
I don't really like this solution but a part of it might help. I would prefer to have the values on the record or linked in another table etc.
Josh
Thanks for reply.
The Code var is indeed a record and the values too need to get linked to a table.
Basically we have a record from Item Variant table. Then based on 1st number, the record need to be converted/formated to, lets say Colour (1 = black, 2 = white etc), then this colour will be inserted to a different table.... So this new table will act as a translator.
Would appreciate further advice.
Thanks in advance.
You can try below code