I migrated from PowerBuilder 2019 to 2022.
What is the reason why the LenA function is applied or not?
If the part where the LenA function is applied is executed successfully twice, then it does not work.
If I quit PowerBuilder and run it again, it works fine.
Is there a solution?
- You are here:
- Home
- Q&A
- Q&A
- PowerBuilder
- LenA function problem after migrating to PowerBuilder 2022
- Jeong Dae Ryong
- PowerBuilder
- Friday, 19 January 2024 04:54 AM UTC
- Friday, 19 January 2024 08:29 AM UTC
- PowerBuilder
- # 1
Hi.
Can you explain the following?
What is the reason why the LenA function is applied or not?
If the part where the LenA function is applied is executed successfully twice, then it does not work.
An example would be helpful...
Andreas.
- Friday, 19 January 2024 08:21 AM UTC
- PowerBuilder
- # 2
This is an example about how to replace LenA with a different implementation. I provide this as follow-up to my answer to Miguel in https://community.appeon.com/index.php/qna/q-a/lena-function-problem-after-migrating-to-powerbuilder-2022#reply-44332.
global type lena from function_object
end type
forward prototypes
global function long lena (string as_str)
global function long lena (blob abl_blb)
end prototypes
global function long lena (string as_str);messagebox("1", "This is a custom implementation of lena")
return len(as_str)
end function
global function long lena (blob abl_blb);messagebox("2", "This is a custom implementation of lena")
return len(abl_blb)
end function
The main problem with that implementation is that from IDE you can only add one signature for a global function! The second one was added using Edit Source.
Example for calling:
messagebox("Resulting Length:", lena("testing"))
messagebox("Resulting Length:", lena(blob("testing")))
In my tests both calls will first show the messagebox inside lena and after the "Resulting Length" messagebox.
While it's possible to change that way a PB's system function with our own implementation, this should be carefully used... That's because, if someone reads the code in a later time, it may not be aware of that change... It can be confusing. Also, in that specific case we have to be sure that we won't have to work with DBCS strings.
Andreas.
- Miguel Leeuwe
- Friday, 19 January 2024 10:36 AM UTC
-
Helpful Loading... Helpful 0
- Friday, 19 January 2024 06:33 AM UTC
- PowerBuilder
- # 3
Sounds like a bug. You should open a support ticket.
- Friday, 19 January 2024 05:06 AM UTC
- PowerBuilder
- # 4
Hi,
I think you should use Len() instead of LenA().
- Miguel Leeuwe
- Friday, 19 January 2024 07:21 AM UTC
-
Helpful Loading... Helpful 0
- Andreas Mykonios
- Friday, 19 January 2024 08:09 AM UTC
Andreas.
-
Helpful Loading... Helpful 1
- Miguel Leeuwe
- Friday, 19 January 2024 10:35 AM UTC
-
Helpful Loading... Helpful 0
- Page :
- 1
However, you are not allowed to reply to this question.