Hello everybody,
It is possible to store a database field name into a variable for further use in queries like the one below.
I'm asking you because I have a report which have a "for each" that breaks by many fields an I have to calculate subtotals. I'm doing this with procedures. Now I send only the value of a field to that procedure and I want to send also the field name so that I don't have to create tens of procedures for all the situations.
Code now is something like this:
I want to write fewer procedures like the one below
So the system will now that field3_name contains the name of the field and has field3_value as the value of it.
Thank you very much and I hope I made myself clear.
It is possible to store a database field name into a variable for further use in queries like the one below.
Code:
def var x as char.
x = "field_name";
for each table where x = "value" ...
I'm asking you because I have a report which have a "for each" that breaks by many fields an I have to calculate subtotals. I'm doing this with procedures. Now I send only the value of a field to that procedure and I want to send also the field name so that I don't have to create tens of procedures for all the situations.
Code now is something like this:
Code:
for each temp-table ... break by field1 by field2 by field3:
.....
if last-of (field3) then run procedure calc_prod (input field3_value)
....
end.
procedure calc_prod:
def input parameter field3_value like db_field.
for each totals_table where field3 = field3_value break by other fields:
....code
end.
I want to write fewer procedures like the one below
Code:
for each temp-table ... break by field1 by field2 by field3:
.....
if last-of (field3) then run procedure calc_prod (input field3_name field3_value)
....
end.
procedure calc_prod:
def input parameter field3_name as char
def input parameter field3_value as char.
for each totals_table where field3_name = field3_value break by other fields:
....code
end.
So the system will now that field3_name contains the name of the field and has field3_value as the value of it.
Thank you very much and I hope I made myself clear.
