0
There is a field in the SQL of my form with the alias "Number/Minuta", and when the SQL is executed for the second time the message Field 'Number' not found is fired. I can solve this by giving a Close and then Open in the query, but I can’t do that because it changes the screen.
What I noticed was that the message only appears 'Number' as field not found and not 'Number/Minuta'. If I remove "/" from the alias and leave "Minuta number", for example, it works normally. I would like to know the relation of "/" in the name with this error.
Note: the error is not only from the bar, but apparently for any symbol, because if I put "Number@minuta" in the alias, the error is also triggered.
The section where the error occurs:
with zqryLista do
begin
if zqryLista.Active then
begin
zqryLista.Refresh;
end
else
zqryLista.Open;
end;
I suggest not to use symbols in alias. Use the Displaytext property of Field: zqryLista.Fieldbyname('NUMERO'). Displaytext := 'Number/Minute';
– Ricardo Alves Carvalho
It is a dynamic query built at runtime, the alias is used to assign the column names of a grid, and the sql can change with each run, so it has to be done with the alias
– Alisson Bomfim
Alisson, I think you’re hardly gonna get out of trouble with this kind of field name. Even with the dynamically created query, it is possible to find a better strategy to name the fields. To display different text in the grid column, Displaytext of the field object resolves. You can also adjust the display title on the grid column objects. As you say the first time it works, one option is to create the query object also dynamically, so it will always be the first time.
– Ricardo Alves Carvalho