1. Alexander Strelkov
  2. PowerBuilder
  3. Saturday, 24 March 2018 08:48 AM

Hi,

I use PBNI class and  try to call GetItemNumber/GetItemDecimal methods of some transferred to c++ DataWindow object reference/ All works just fine until DataWindow's numeric cell contains NULL value. In this case PB crashed when session->InvokeObjectFunction(...) is invoked as from IDE and from standalone EXE module. My PB version 2017 (build 1666). The same result has been received  in PB 11.5 so I think that this is a very long PB error. 

P.S.:

I use MS VS 2017 (Community Edition) and professional Windows 7 64 bit OS.

 

Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 25 July 2019 17:27 PM
  2. PowerBuilder
  3. # 1
0
Votes
Undo

Here are some lines of C++ code from one of my programs that is passed an array of numbers:

IPB_Value* ipv;

pblong somenumber;

ipv = session->AcquireArrayItemValue(pbArgValues, dim);

if (ipv->IsNull()) {
   // value is null
}
else {
   // value is not null

   somenumber = ipv->GetLong();
}

 

I haven't tried accessing a DataWindow from C++ but it should be similar.

 

Comment
Roland,



As I've written about this already:

With regard to IsNull: we must get that value before to apply it, i.e. call GetItemNumber/Decimal method. But exactly this call leads to crash the PB/PBNI session. A very strange error.
  1. Alexander Strelkov
  2. Thursday, 25 July 2019 17:50 PM
Is the crash from PB code called from C++ or in the C++ code?
  1. Roland Smith
  2. Thursday, 25 July 2019 18:06 PM
There are no comments made yet.
QX QX Accepted Answer Pending Moderation
  1. Thursday, 25 July 2019 06:23 AM
  2. PowerBuilder
  3. # 2
0
Votes
Undo

what is IsNull method?

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 26 March 2018 12:23 PM
  2. PowerBuilder
  3. # 3
0
Votes
Undo

I have done a lot with PBNI but have not tried accessing a DataWindow. I do know there is an IsNull method.

I have VS Community 2015 & 2017 on Windows 10.

 

Comment
Roland,



I know that you have a strong experience with PBNI and very glad that you have been replied for my message.Before to call a check function such



as IsNull we must get that value, i.e. call GetItem method. But exactly this call crash the PB/PBNI session. A very strange error. The self-titled call in



pure PB works fine, and more, GetItemString, GetItemTime, GetItemDate GetItemDateTime methods are invoked via PBNI without any problem in the



same situation. The ambush with numeric fields only.

  1. Alexander Strelkov
  2. Monday, 26 March 2018 18:24 PM
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.