1. Paul Wiebe
  2. PowerBuilder
  3. Wednesday, 22 January 2020 21:23 PM UTC

I am receiving the below error when running a function, but if I run the function with a different dataset, then this works without issue. Nothing is changing between runs except the dataset being loaded, but one returns the error, and the other does not.

Screen Shot 2020-01-22 at 9.26.25 AM.png

 

Paul

Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
  1. Wednesday, 22 January 2020 21:42 PM UTC
  2. PowerBuilder
  3. # Permalink

What happens in that line 51?
Are there ANY structural difference between failing and succeeding datasets?

(Line 1, column 44) => Could be position inside a text string to dw.Modify that fails for this particular dataset.

Comment
  1. Paul Wiebe
  2. Wednesday, 22 January 2020 22:19 PM UTC
I am putting this here just so I can include the fix and attribute the "Accept as Answer" to you since you were right. The issue turned out to be a TAB character that was included in the string being set to my text property. Removed the TAB character and the issue disappeared. Thanks.
  1. Helpful 1
  1. Michael Kramer
  2. Wednesday, 22 January 2020 23:11 PM UTC
TAB caused havoc because expression based values used syntax = "<FixedValue><TAB><Expression>".

How to fix and keep TAB => Encode the TAB character and be aware of extra level of "tilde art" for every set of quotes.

EXAMPLE: Fixed value = $Hello$ -- and -- Expression = $"How<TAB>Goes"$ (using $ as "meta-quote")

(1) Encode special characters (TAB, CR, LF) to tilde-combos (~t, ~r, ~n)

(2) Prepare expression for outer quotes => Extra level of "tilde art"

(3) Create full expression combining fixed value and expression within a common quote-set.

ls_command = 'welcome_t.Text="Hello~t~"How~~~tGoes~""'

Modify-expressions are tilde-art" ;-)
  1. Helpful
There are no comments made yet.
Paul Wiebe Accepted Answer Pending Moderation
  1. Wednesday, 22 January 2020 22:00 PM UTC
  2. PowerBuilder
  3. # 1

My apologies, I completely ignored your first question and that was not intentional. Essentially this code is taking the result of two other datasets and compiling them into information visible on the datawindow. Structurally the datasets should be identical, and the data being explored so far between the two is just a few string values to build up some title values.

 

Also, I tried switching this statement to a .Modify instead, and that doesn't error, but it also doesn't apply the title change.

Not sure if that information is helpful, but I'll continue looking into structural differences between a failing and succeeding dataset to see if I can come up with any other useful information.

Paul

Comment
  1. Paul Wiebe
  2. Wednesday, 22 January 2020 22:05 PM UTC
It looks like there is a tab value in the property that I was not aware of. I'll try removing that and see if that resolves the problem.
  1. Helpful
  1. Paul Wiebe
  2. Wednesday, 22 January 2020 22:08 PM UTC
That was the issue. I remove the tab from the property that I am using to try and set the .text value with and then it works no problem. Thanks.
  1. Helpful
  1. Joseph Vendra
  2. Friday, 12 November 2021 21:44 PM UTC
Thanks, found all the posts in the chain helpful and now I wont have these issues in the future, along with original information I am sharing what I did to log and prevent PB app crashes due to things like this.



Consider using a try catch and log the error that occurs preventing any 'crash' of the app and letting it continue on, might be smoother.

You may not want to do this all the time if performance or any such things are a concern but it does prevent any nasty PB application errors and could avoid abruptly terminating your application.

In my case I was just using a text object on the datawindow and dynamically setting it to a value during processing to ensure users are getting enough feedback during a long running process.



Your post helped because I realized even though I can store a string that had an embedded "I" value wrapped in quote marks to the column when setting that same value to a .text property it would crash the app due to the described syntax issue.



This is straight out of the APPEON documentation:

https://docs.appeon.com/pb2019/datawindow_reference/ch05s03.html

Try

dw_1.object.t_col.text = LS_VALUE // Or perhaps a .modify or .object.column[row] = variableValue

Catch (DWRuntimeError myExc)

SomeLogFunction("DW Exception: "+&

"error#: " + string(myExc.number) + "~r~n" +&

"text: " + myExc.text + "~r~n" + &

"script: " + myExc.routinename + "~r~n" + &

"object: " + myExc.objectname + "~r~n" + &

"line: " + string(myExc.line) + "~r~n")

End Try



Also, what I did to prevent future errors in the first place is rather than transform the data to store in the database, I just transformed the data value before assigning it to the .text object in question to handle embedded "V" values.



Joseph
  1. Helpful
There are no comments made yet.
Paul Wiebe Accepted Answer Pending Moderation
  1. Wednesday, 22 January 2020 21:49 PM UTC
  2. PowerBuilder
  3. # 2

There is a datawindow object where the text property of object Quote_title (in this case) is being modified. It is being set to "Title: " + ls_Title where ls_Title is being extracted from another datawindow. This gives me the title being used for this quote so we can display it.

The rest of the function runs just fine, if I comment this line out then it works with no issue, but with certain datasets it just does not want to set this text property. Unfortunately I am not sure where the "Line 1 Column 44" is referring to. My assumption is the datawindow with Quote_title that is being set, but I'm not sure.

Paul

Comment
  1. Michael Kramer
  2. Wednesday, 22 January 2020 22:00 PM UTC
Could you log the actual value that code tries to set?

It may be a non-quoted single or double quote corrupting the value.
  1. Helpful
  1. Paul Wiebe
  2. Wednesday, 22 January 2020 22:04 PM UTC
dw_Report.Object.Quote_title.text = "Title: " + ls_Title



A successful value is "Hands and Feet" (copied from PB IDE)

A failed value is "We Sleep We Eat " (also copied)
  1. Helpful
There are no comments made yet.
Paul Wiebe Accepted Answer Pending Moderation
  1. Wednesday, 22 January 2020 21:32 PM UTC
  2. PowerBuilder
  3. # 3

Sorry. I thought it had copied into the body of the message properly. I've attached an image with the error message now.

Paul

Attachments (1)
Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 22 January 2020 21:27 PM UTC
  2. PowerBuilder
  3. # 4

Hmm ... I do not see any screen shot attachment!  :0(

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.