The PoddyShein credit management statement crashing problem
UNILYNX
9-6-18
We have an issues with a program crashing the server on the instruction OpenForm(formcode).

We made a very simple program per below to try and see why this crash occurs: -

/ VER: 8.2 and latest 8.4
// UST: 23.09.2008 (update)
// VER: 5.3 071214
// UST: 10.01.2008

global
procedure RunCMForm(record RcVc RepSpec)
begin


string 30 formcode;
formcode = "MICKEYMOUSE";

LogText(0,"Before OpenForm");
OpenForm(formcode);
LogText(0,"After OpenForm");

return;
end;


I have defined a blank form called "MICKEYMOUSE" in the database
This crashes the database and the client when it hits openform()


Do you have any thoughts on what would cause this i.e. is there something else that needs to be initialised before calling OpenForm(formcode) so that it doesn’t crash ?

These are the relevent portions Windows.hal

window CMRClass:1
wtag("language","ENG"), wtag("product",""), wtag("productcode",""), wtag("device","computer")
begin
real v,vs,h;

WindowBegin("Specify Credit Management",CMRClass,CGRcW,RcType);
SetWRect(20,80,450,450);
StaticText(20,v=20,"Filter Records:",false);
EditField(h=150,v+=6,160,"Credit Managements",Normal,f1,false,CMSClass);
CheckBox(h,v+=20,0,"Include Zero Balances",flags[2]);
CheckBox(h,v+=16,0,"Include Closed",flags[3]);
CheckBox(h,v+=16,0,"Include On Hold",flags[4]);
EditField(h,v+=20,80,"Customer",Normal,f2,false,CUSClass);
EditField(h,v+=20,200,"Classifications",Normal,f3,false,CUClassSClass);
EditField(h,v+=20,80,"Branch",Normal,AccStr,false,LocationSClass);
StaticText(20,v+=40,"Filter Rows:",false);
PeriodField(h,v+=6,"Period");
EditField(h,v+=20,150,"Transaction Types",Normal,f4,false,CMTTSClass);
EditField(h,v+=20,50,"Number of Rows",Normal,flags[3],false,0);
EditField(h=80,v+=30,100,"Std. Text",Normal,f5,false,LTxtSClass);
ButtonFrame(h=200,v+=16,100,3,"Type");
RadioButton(h,v,0,0,"Normal",flags[10]);
RadioButton(h,v+=16,1,0,"Monthly Statement",flags[10]);
RadioButton(h,v+=16,2,0,"Write Off",flags[10]);

RadioButton(h,v+=16,3,0,"Surrender Goods",flags[10]);
RadioButton(h,v+=16,4,0,"Write Off Reversal",flags[10]);
RadioButton(h,v+=16,5,0,"Surrender Goods Reversal",flags[10]);

RadioButton(h,v+=16,6,0,"Final Agreement",flags[10]);
RadioButton(h,v+=16,7,0,"Mini Statement",flags[10]);
RadioButton(h,v+=16,99,0,"Custom Document",flags[10]);
EditField(h+140,v,80,"",Normal,f6,false,DocSClass);

EndWindow;
end;

and


window CMFClass:1
wtag("language","ENG"), wtag("product",""), wtag("productcode",""), wtag("device","computer")
begin


WindowBegin("Definition Credit Management",CMFClass,CGHbl,HBlRecType);
SetBlid(CMDefBlock);
FORMDEF;
EndWindow;
end;


and in startup.hal is the following

Document("Credit Management",CMRClass,RunCMForm,CMFClass,modCM);

Any help would be greatly appreciated.

Thank you
UNILYNX
9-7-18
The problem has been solved.

The corrected Hal code looks as follows:-

// VER: 5.4 080912
// UST: 23.09.2008 (update)
// VER: 5.3 071214
// UST: 10.01.2008


global
procedure DoRunCMForm(record RcVc Dummyr,record RcVc RepSpec)
begin

    string 30 formcode;
    boolean testf;

    formcode = "INVOICE";

    LogText(0,"Before OpenForm 0");
   
//    FormLabelGrid(1,1,1,1);
    LogText(0,"Before OpenForm 1");
    testf = (OpenForm(formcode)==true);

CloseForm;
    LogText(0,"After OpenForm: " & testf);

return;
end;


global
procedure RunCMForm(record RcVc RepSpec)
BEGIN
boolean tmpf;


tmpf = PrintDocument(RepSpec,"RunCMForm",false);

LBH_StockMovLabelForm:;

RETURN;
END;




So the procedure with openform() in it has to be called via PrintDocument()

tmpf = PrintDocument(RepSpec,"RunCMForm",false);
Giuseppe L.
9-7-18
Hello and thanks for contributing to fixing the issue. Appreciated

Giuseppe
HansaWorld Italy
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Back to the list
Latest Posts
Reino Botha
Please check your version of android if it is the same as the server you are connecting too. ...
08:24 21 Nov 2024
Bror-Erik Kotiranta
In NC you hace operations>>ai chats. They are used for these Br, Bror-Erik...
05:12 21 Nov 2024