Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Widememo and PostgreSQL



Permlink Replies: 6 - Last Post: Nov 30, 2017 11:33 PM Last Post By: Lena Ilicheva Threads: [ Previous | Next ]
Lena Ilicheva

Posts: 83
Registered: 9/22/06
Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 28, 2017 3:28 AM
Hi.
On the form FDConnection1, FDQuery1, DataSource1 and DBGrid1.
The query selects data from the table in the PostgreSQL database. In the table there are columns with type PostgreSQL TEXT.
In DBGrid1, WIDEMEMO is displayed instead of the text. Tell me, please, how to see the real text?
Dmitry Arefiev said that I can use TBlobField.DisplayValue but I did not find this property.
http://videoplay.um.la/dv.jpg
Thank you.
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 28, 2017 4:10 AM   in response to: Lena Ilicheva in response to: Lena Ilicheva
Lena Ilicheva wrote:

Hi.
On the form FDConnection1, FDQuery1, DataSource1 and DBGrid1.
The query selects data from the table in the PostgreSQL database. In
the table there are columns with type PostgreSQL TEXT. In DBGrid1,
WIDEMEMO is displayed instead of the text. Tell me, please, how to
see the real text? Dmitry Arefiev said that I can use
TBlobField.DisplayValue but I did not find this property.
http://videoplay.um.la/dv.jpg Thank you.

This is a limitation of the TDBGrid component not a FireDAC issue. Text
fields usually contains more than one line and grid is not the best to
display it. The original authors of the VCL has decided to not support
it.

However in read only mode you can display the value of these fields
using the OnDrawColumnCell event of the TDBGrid or use a more advanced
third party grid.
Lena Ilicheva

Posts: 83
Registered: 9/22/06
Re: Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 29, 2017 1:34 AM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Here for SQLlite+FireDAC:
https://forums.embarcadero.com/message.jspa?messageID=691725
But for PostgreSQL no parametr Stringformat=Ansi :(
Dmitry Vavilov

Posts: 29
Registered: 9/23/17
Re: Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 29, 2017 2:23 AM   in response to: Lena Ilicheva in response to: Lena Ilicheva
If you want to display in a table, then try TFDConnection.FormatOptions.MapRules (SourceDataType = dtWideMemo, TargerDataType = dtWideString).
If you want to access the value in the code, then FDQuery1.FieldByName('<FieldName>').AsString
Lena Ilicheva

Posts: 83
Registered: 9/22/06
Re: Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 30, 2017 5:19 AM   in response to: Dmitry Vavilov in response to: Dmitry Vavilov
try TFDConnection.FormatOptions.MapRules (SourceDataType = dtWideMemo, TargerDataType = dtWideString).

And set in object inspector: OwnMapRules=true
ERROR:
Exception class EDatabaseError with message 'FDQuery1: Type mismatch for field 'timestring', expecting: WideMemo actual: WideString'.
:(

Edited by: Lena Ilicheva on Nov 30, 2017 5:25 AM
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 30, 2017 5:48 AM   in response to: Lena Ilicheva in response to: Lena Ilicheva
Lena Ilicheva wrote:

try TFDConnection.FormatOptions.MapRules (SourceDataType =
dtWideMemo, TargerDataType = dtWideString).

And set in object inspector: OwnMapRules=true

Exception class EDatabaseError with message 'FDQuery1: Type mismatch
for field 'timestring', expecting: WideMemo actual: WideString'.

With mapping you change the type for the fild, recreate the fields.
Lena Ilicheva

Posts: 83
Registered: 9/22/06
Re: Widememo and PostgreSQL
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 30, 2017 11:33 PM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Thank you very much Dmitry Vavilov and Lajos Juhasz now everything works as it should!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02