1. Miguel Alzate
  2. PowerBuilder
  3. Saturday, 27 April 2024 18:15 PM UTC

Hi, all.

I let users enter text data in multiline edit control, allowing them to include line breaks. Then, I need to import this data in a DW with the importstring method (necessarily). How do I have PB not interpet the line breaks in the data as row delimiters?

Thank you very much for your answers.

 

René Ullrich Accepted Answer Pending Moderation
  1. Monday, 29 April 2024 06:29 AM UTC
  2. PowerBuilder
  3. # 1

Hi Miguel,

I have not tested it with ImportString, but maybe it will work.

With ImportFile this works:

If you have CRLF in your data you have to use quotes arround your data. If you want to use quotes in your data you have to double it.

 

Example data:

"a1"	"b1
bb1"	"""c1"""
"a2"	"b2
bb2"	"c2"

Results in:

Maybe this works with ImportString in the same way.

HTH,

René

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 27 April 2024 18:41 PM UTC
  2. PowerBuilder
  3. # 2

Hi Miguel,

You say "necessarily" to use importstring, but I think that that's your problem. Try doing SetItem(s).

Comment
  1. Miguel Alzate
  2. Saturday, 27 April 2024 19:51 PM UTC
Hello, Miguel.



Thank you very much for your answer.



Certainly, it is necessary to use the "ImportString" method since it is part of a global strategy for dynamic management of forms in the application and changing it to "SetItem" would imply a significant change in the corresponding algorithms.



I have a question: How does PB (or SQL Server) store line break characters in the database columns? I say this to consider the possibility of making a temporary replacement of such characters in the text of the multiline control, before and after importing the text.
  1. Helpful
  1. Miguel Leeuwe
  2. Sunday, 28 April 2024 10:00 AM UTC
Hi Miguel,

I guess sql server just stores it as the equivalent of char(13) + char(10).

I came back to this post to propose an exact workaround that you've already mentioned:

1. retrieve the data in a datastore.

2. temporarily replace the enters with some special character

3. do the ImportString()

4. run through the imported rows to replace the special character with enters.

Regards.
  1. Helpful
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.