1. Karen Gray
  2. PowerBuilder
  3. Friday, 8 October 2021 01:53 AM UTC

Hi

 We are using PB2017R3 against Postgresql version 10 using ODBC driver.

 

We have a bug where an error  message of over 320 chars is being truncated to 255 characters.

 

Is there a limit set somewhere that can be adjusted please?

 

e.g. "You have selected more than one Owner.  Verify that they are one and the same.~r~n~r~n- If the name appears in different shares/interests, continue with processing~r~n- If there are different versions of the name add an explanation in Complex mode (Clarify Intent)~r~n- If different registered owners have been selected, use separate transmissions."

 

gets truncated to 

 

"You have selected more than one %s.  Verify that they are one and the same.~r~n~r~n- If the name appears in different shares/interests, continue with processing~r~n- If there are different versions of the name add an explanation in Complex mode (Cl"

 

The CR and NL display correctly. Its just that it only seems to show the first 255 charcaters

Accepted Answer
Géza Bartha Accepted Answer Pending Moderation
  1. Friday, 8 October 2021 13:43 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi!

 

You should survay your pgodbc settings. There are three tab under the datasource button.

The first is important. You need to check 

Unknown sizes: Maximum

Data Type Options: Text as Longvarchar

At the end, You need to set Max LongVarchar to 8190

The another important thing, when you add string param, to the postgre sp, and You wait any result.

You need to allocate space

ls_place = Space(5000)

after calling, zou need to trim the result.

 

Regards,

G.

 

 

 

 

Comment
  1. Karen Gray
  2. Sunday, 10 October 2021 20:19 PM UTC
hi Geza, thanks for your reply. I have a generic ODBC profile setup - I cannot see a databasource tab.

Can you point me to where you have the pgodbc download please?



I will attach screenshots soon.
  1. Helpful
  1. Karen Gray
  2. Sunday, 10 October 2021 20:30 PM UTC
ah i've found it thank you - but i already had those settings for the Max LongVarchar to 8190- I will try the allocate space process now
  1. Helpful
There are no comments made yet.
Karen Gray Accepted Answer Pending Moderation
  1. Tuesday, 12 October 2021 00:55 AM UTC
  2. PowerBuilder
  3. # 1

Thanks for all your replies - especially Géza Bartha who put me on the right track

 

I have now modified my ODBC configuration to the set MAX VARCHAR to 650 (it was originally 255), and this has now fixed 

the truncation issue.

 

See the attached images.

Attachments (2)
Comment
  1. Miguel Leeuwe
  2. Tuesday, 12 October 2021 03:07 AM UTC
Great to hear that! Never too old to learn…
  1. Helpful
  1. John Fauss
  2. Tuesday, 12 October 2021 04:17 AM UTC
Congratulations, Karen! Thank you for sharing the solution and for marking the issue as resolved.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 11 October 2021 20:05 PM UTC
  2. PowerBuilder
  3. # 2

Does your application override the of_LoadPredefinedMsg function in n_cst_error?

If not (and if you have not made changes to this function in the ancestor object pfc_n_cst_error), then the following code is executed to load the messages:

// If appropriate, create the datastore cache.
If IsNull(ids_messages) Or Not IsValid(ids_messages) Then
   ids_messages = Create n_ds
   ids_messages.dataobject = 'd_definedmessages'
End If

// Reset the datastore.
ids_messages.Reset()

// Retrieve data into the datastore using the appropriate input source.
If is_msgsrc = DATABASE Then
   ids_messages.setTransObject(itr_msgdb)
   If ids_messages.Retrieve() >0 Then
      Return 1
   End If
ElseIf is_msgsrc = FILE Then
   If ids_messages.ImportFile(is_msgfile) >0 Then
      Return 1
   End If
End If

Return -1

This code will use the PFC-supplied DataWindow "d_definedmessage", which limits the message text to 255 characters.

So, like Miguel, I'm confused about your comment regarding an override "window" named d_crs_sys_messages". ???

Have you used the PB Debugger to see what the PFC Error service is doing, if the message is truncated at 255 characters? I think there is more going on here than what you have disclosed or communicated.

Comment
There are no comments made yet.
Karen Gray Accepted Answer Pending Moderation
  1. Sunday, 10 October 2021 20:48 PM UTC
  2. PowerBuilder
  3. # 3

Further information - thanks for all your replies - :

Attached are 2x images - one of the message truncation showing in a response window,

 

and the second is of the postgresql ODBC settings

Attachments (2)
Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 8 October 2021 02:50 AM UTC
  2. PowerBuilder
  3. # 4

This is just "a guess" but maybe the following is what's happening to you?

If you are using the PFC messages table, then there's a datawindow called "d_definedmessages" in pfcapsrv.pbl and maybe also in pfeapsrv.pbl or any other layer of inherited classes you use with the pfc.
The field length for the 'msgtext' field is 255, so that would mean a truncation that is taking place. Maybe the table you are using has been altered to allow for more characters, but the d_definedmessages would have to be modified too.

source code in d_definedmessages:

column=(type=char(255) update=yes updatewhereclause=yes name=msgtext dbname="messages.msgtext" )

Doing a search on its use:

 ---------- Search: Searching Target client_cq for 'd_definedmessages'    (03:44:17)
 ---------- 2 Matches Found On "d_definedmessages":
pfeapsrv.pbl(n_cst_error).of_loadpredefinedmsg.0032:   ids_messages.dataobject = 'd_definedmessages'
pfcapsrv.pbl(pfc_n_cst_error).of_loadpredefinedmsg.0050:   ids_messages.dataobject = 'd_definedmessages'
 ---------- Done 2 Matches Found On "d_definedmessages":
 ---------- Finished Searching Target client_cq for 'd_definedmessages'    (03:44:17)
Comment
  1. Karen Gray
  2. Sunday, 10 October 2021 20:07 PM UTC
Thanks for that - yes i am aware of the d_Definedmessages datawindow - but what is actually happening is that we have a descendent window d_crs_sys_messages which has a desc field defined as 2048 varchar - but when the message is retrieved and passed to the error service - it is being displayed in the error service with only 255 characters
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 11 October 2021 12:18 PM UTC
Yw

When you open d_crs_sys_messages in the powerbuilder datawindow painter and do a retrieve, is the text yield also truncated? (Assuming it’s a dw and not sure what you mean with descendant window).
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 8 October 2021 02:21 AM UTC
  2. PowerBuilder
  3. # 5

Hi,

It's not clear to me 'how', 'from where', 'when' you get this error message and 'when is the error message truncated' or how the odbc driver is implicated in this process.

Are you having the value in a string (with all the characters) and then when using the pfc inv_error.of_message(...) function the text is truncated?

Please give us a bit more information.

regards.

Comment
  1. Karen Gray
  2. Sunday, 10 October 2021 20:09 PM UTC
Thanks for that -what is actually happening is that we have a descendent window from d_Definedmessages names d_crs_sys_messages which has a desc field defined as 2048 varchar - and when the message is retrieved and passed to the error service - it is being displayed in the error service with only 255 characters. Under the informix ODBC driver the same process displays the full message text.
  1. Helpful
There are no comments made yet.
Karen Gray Accepted Answer Pending Moderation
  1. Friday, 8 October 2021 02:05 AM UTC
  2. PowerBuilder
  3. # 6

I failed to mention that we are using the pfc libraries - so its using the default pfc error behaviiur.

 

We have converted from Informix to Postgresql and the error messages displayed fully under the Informix ODBC driver. But are being truncated with the postgresql ODBC driver.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.