Hi again, thanks for the reply
Ok, I'm tring to replace field definitions in a table with the actual data. So I have say a 2x2 table with
|Date of birth |#{Field Name 1}|
|Age |#{Field Name 2}|
I need to replace it with
|Date of birth |25/05/1970|
|Age |35 |
I have a parser that handles various types of field definitions but it was not designed with recursion in mind.
So the question real is how to create the output table from the input table without accessing the tables recursively from my parser.
Below is a code snippet
Code: Select all
for x := 0 to RichViewEdit1.ItemCount -1 do begin
s := RichViewEdit1.GetItemTextA(x);
s := StringReplace(s, '}#{', '} #{', [rfReplaceAll, rfIgnoreCase]);
s := Trim(s);
if Copy(Trim(s), 1, 3) = '#{*' then begin
while Pos('*', S) > 0 do
Delete(S, Pos('*', S), 1);
while Pos('{', S) > 0 do
Delete(S, Pos('{', S), 1);
while Pos('}', S) > 0 do
Delete(S, Pos('}', S), 1);
while Pos('#', S) > 0 do
Delete(S, Pos('#', S), 1);
nf := FieldNameStrXX(Trim(s)); // FIELD NAME TO STRING
tagid := Ord(nf); // FIELD ID
GetFieldValue(t, tagid, Trim(s)); // FIELD VALUE TO STRING -> S
itm := RichViewEdit1.GetItem(x); // RICHVIEW ITEM
itm.StyleNo := TEXTSTYLE_FIELD;
List.Text := t;
for ii := 0 to List.Count -1 do
RichViewEdit1.SetItemTextW(x, List[ii]); // SET STRING TO ITEM
if List.Count -1 = 0 then
RichViewEdit1.SetItemTextW(x, '');
RichViewEdit1.SetItemTextW(x, t)
end else if Copy(Trim(s), 1, 2) = '{*' then begin
while Pos('*', S) > 0 do
Delete(S, Pos('*', S), 1);
while Pos('{', S) > 0 do
Delete(S, Pos('{', S), 1);
while Pos('}', S) > 0 do
Delete(S, Pos('}', S), 1);
nf := FieldNameStrXX(s);
tagid := Ord(nf);
GetFieldValue(t, tagid, s);
itm := RichViewEdit1.GetItem(x);
itm.StyleNo := TEXTSTYLE_FIELD;
List.Text := t;
for ii := 0 to List.Count -1 do
RichViewEdit1.SetItemTextW(x, List[ii]);
if List.Count -1 = 0 then
RichViewEdit1.SetItemTextW(x, '');
RichViewEdit1.SetItemTextW(x, t)
end else if Copy(s, 1, 2) = '#{' then begin
Again thanks in advance