TMemoField instead of TStringField. lazarus / 16-Databases ---------------------------------------------------------------------- BSaidus · 2025-09-29 14:18 Hello. I use TZQuery from ZeosDBO and I have a an SQLITE View witch is an SQL aggregation of some fields from different tables. Say    vtmp_1 is a view, and    f1: a VARCHAR field,    f2: a VARCHAR field,    f3: a VARCHAR field,    f4: an aggregated field => CAST(('aa_'||LOWER(REPLACE(name, ' ', '_'))||'="'||fname||'"') AS VARCHAR) AS ENAME When I use an SQL SELECT Statement in a ZQuery, I got "f4" as TMemoField In every cases, Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT  f1,        f2,        f3,        f4   FROM vtemp_1;    SELECT  f1,        f2,        f3,        CAST(f4 AS VARCHAR) AS f4   FROM vtemp_1; So Is there any solution for this, I need it to use this fied as a Lookup field in TDBLookupComboBox ( Now it display (memo) as content ). Thank you. ---------------------------------------------------------------------- Zvoni · 2025-09-29 14:28 IIRC, you have to implement the OnGetText-Event for the Field This is similiar to your problem: https://forum.lazarus.freepascal.org/index.php/topic,69567.msg540683.h tml#msg540683 Edit: an alternative approach might be to use generated columns from the get go instead of concatenating it in the query/view But this depends, if the used fields for f4/ename are from the same table ---------------------------------------------------------------------- BSaidus · 2025-09-29 16:58 Quote from: Zvoni on September 29, 2025, 04:28:15 pmIIRC, you have to implement the OnGetText-Event for the Field This is similiar to your problem: https://forum.lazarus.freepascal.org/index.php/topic,69567.msg540683.h tml#msg540683 Edit: an alternative approach might be to use generated columns from the get go instead of concatenating it in the query/view But this depends, if the used fields for f4/ename are from the same table Thanks @Zvoni. It works well, I will investigate the 2nd method. Thnks again. ---------------------------------------------------------------------- Zvoni · 2025-09-30 06:28 Quote from: BSaidus on September 29, 2025, 06:58:43 pmThanks @Zvoni. It works well, I will investigate the 2nd method. Thnks again. As for the second (alternative) Approach (Generated Columns): Could you post the CREATE-Statement for that View? The crucial part is this Quote f4: an aggregated field => CAST(('aa_'||LOWER(REPLACE(name, ' ', '_'))||'="'||fname||'"') AS VARCHAR) AS ENAME "name" and "fname": Are these two fields in the same table? If yes, then i would definitely go with generated Columns instead of "calculating" it via query and then Type-Casting it from here to Moscow If no (they are in separate tables), then your current solution is the only viable way