PeopleCode error while trying to call function on Page PeopleCode event - peoplesoft

I am trying to add the below function (populate_details) to a Page PeopleCode Activate event. The top section of code already exists, I am trying to add the section starting at 6/24/20 comments and getting the error "Syntax error: expecting statement. (2,42) ^ HCSC" If I remove the top section of the code then the error does not display and it saves properly, so I must have some sort of syntax error. Thanks for the help!
import HR_DIRECT_REPORTS:EmployeeSelection;
Component HR_DIRECT_REPORTS:EmployeeSelection &MyUI;
&MyUI.PageActivate();
/*GHS KLG - link to Footprints on termination screen*/
If DERIVED_HR_DR.HR_DR_PAGE_TITLE.Value = "Terminate Employee" Then
GHS_MSS_WRK.HTMLAREA.Value = MsgGetExplainText(31000, 27, "Message not found.");
GHS_MSS_WRK.HTMLAREA.Visible = True;
Else
GHS_MSS_WRK.HTMLAREA.Visible = False;
End-If;
/*GHS end*/
/* GHS KDR 6/24/20 BEGIN */
Declare Function populate_details PeopleCode GH_PERS_INF_WRK.FUNCLIB FieldFormula;
GH_PERS_INF_WRK.EFFDT = %Date;
populate_details(%Date, PERSON_NPC_VW.EMPLID.Value, GH_PERS_SRCH_CW.EMPL_RCD.Value);
/* GHS KDR 6/24/20 END */

You must declare your populate_details function at the top of the Page PeopleCode Activate event. Immediately after this line should work:
Component HR_DIRECT_REPORTS:EmployeeSelection &MyUI;
Then you can call your function as you did, the rest of the code looks fine.

Related

OpenEdge 10.2A - How to apply the default RETURN / CURSOR-DOWN on Editor widget even if a general code for RETURN / CURSOR-DOWN with ANYWHERE exists?

I have a code for RETURN / CURSOR-DOWN for all widgets in a window which basically makes it as if TAB is pressed. It works just fine but I want the default functionality of RETURN (Break current line into two lines) / CURSOR-DOWN for EDITOR widgets.
I have tried to add
APPLY "ENTER" TO SELF.
or
APPLY "RETURN" TO SELF.
or
APPLY "CTRL-J" TO SELF. /*Ctrl-Enter*/
for EDITOR widgets but when pressed RETURN / CURSOR-DOWN in an EDITOR it just does not do anything. It stays as if RETURN / CURSOR-DOWN is not pressed.
ON RETURN OF {&WINDOW-NAME} ANYWHERE
DO:
IF SELF:TYPE="EDITOR" THEN
DO:
APPLY "ENTER" TO SELF. /*Does NOT Work*/
END.
ELSE IF SELF:TYPE = "BUTTON" THEN
DO:
APPLY "Choose".
END.
ELSE
DO:
APPLY "Tab".
RETURN NO-APPLY.
END.
END.
ON CURSOR-DOWN OF {&WINDOW-NAME} ANYWHERE
DO:
IF SELF:TYPE="EDITOR" THEN
DO:
APPLY "CURSOR-DOWN" TO SELF. /*Does NOT Work*/
END.
ELSE
DO:
APPLY "Tab".
RETURN NO-APPLY.
END.
END.
Is there a way to do it?
I've tested this in 10.2B08. Here's the main anywhere trigger:
ON RETURN OF {&WINDOW-NAME} ANYWHERE DO:
IF SELF:TYPE = "BUTTON" THEN DO:
APPLY "Choose".
END.
else do:
apply 'tab'.
return no-apply.
end.
end.
ON CURSOR-DOWN OF {&WINDOW-NAME} ANYWHERE DO:
if self:type ne 'EDITOR' then DO:
APPLY "Tab".
RETURN NO-APPLY.
END.
END.
Not much different from what you had.
Now in the editor, add a trigger to RETURN and one to CURSOR-DOWN.
Here's your editor's RETURN trigger:
self:insert-string(chr(13)).
And here's the editor's CURSOR-DOWN trigger:
DEFINE VARIABLE iOffset AS INTEGER NO-UNDO.
assign iOffset = self:cursor-char
self:cursor-line = self:cursor-line + 1
self:cursor-char = ioffset no-error.
do while error-status:get-message(1) begins '**Unable to set attribute CURSOR-CHAR':
assign iOffset = iOffset - 1
self:cursor-char = ioffset no-error.
if iOffset = 1 then leave.
end.
Let me know if this works for you. Seems to be ok for me here.

SyntaxError: Parse error - Wkhtmltopdf with react-pdf-js lib

I am using wkhtmltopdf version 0.12.2.1 (with patched qt) to render my reactJs app! It worked fine, until I added the react-pdf-js lib to render the pdf generated inside my app. I followed the code described on react-pdf-js documentation (see https://www.npmjs.com/package/react-pdf-js) to make it work.
The pdf is rendered inside my page, and it looks pretty cool indeed. But when I try to run wkhtmltopdf again, to generate a pdf of any page of my app, the following error is returned:
desenv01#desenv01-PC:~$ wkhtmltopdf -O Landscape --print-media-type --debug-javascript http://localhost:3000/report/1 report.pdfLoading pages (1/6)
Warning: undefined:0 ReferenceError: Can't find variable: Float64Array
Warning: http://localhost:3000/assets/js/app.js:46789 SyntaxError: Parse error
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Then, I went to my app.js to see what's on line 46789:
set href(href) {
clear.call(this);
parse.call(this, href);
},
get protocol() {
return this._scheme + ':';
},
set protocol(protocol) {
if (this._isInvalid)
return;
parse.call(this, protocol + ':', 'scheme start');
},
The error happens on the line that says parse.call(this, href);, which is part of pdf.combined.js script.
I could not find any solution online so I wondered if there is anyone who might know if I did something wrong or a way to work around it.
Thanks..
I ran into this using wkthmltopdf 12.3 and 12.4 because I have my IDE set to nag me for using var instead of let. The problem is the older Qt engine powering those versions of the program doesn't recognize new-style, ES6 keywords. Not sure if you can down-convert React. Otherwise you can try the bleeding edge versions which use a newer Qt.
I have same problem. I fixed it by modify some code that i think it is new in JS. let keyword (ES5) and template literals (ES6).
generateRandomColor= function () {
let maxVal = 0xFFFFFF; // 16777215
let randomNumber = Math.random() * maxVal;
randomNumber = Math.floor(randomNumber);
randomNumber = randomNumber.toString(16);
let randColor = randomNumber.padStart(6, 0);
return `#${randColor.toUpperCase()}`
}
I modify above code into below
generateRandomColor = function () {
var maxVal = 0xFFFFFF;
var randomNumber = Math.random() * maxVal;
randomNumber = Math.floor(randomNumber);
randomNumber = randomNumber.toString(16);
var randColor = randomNumber.padStart(6, 0);
return "#" + randColor.toUpperCase();
}

text input validation for numeric check

I am seeing a strange issue in flex. I need to reset all text input fields to 0 once the
user submits the values to be calculated. In the method
private function calculate():void {
resetToZero();
var num:Number = parseFloat(s21.text);
}
private function resetToZero():void {
//multiple if statements.... existing here..
if(s2l.text.length ==0);
{
Alert.show("length is:" + s2l.text.length);
s2l.text="0";
}
}
When I am running the program I am getting the alert - length is 1. How is that it when length is 1 it is entering the if statement?. The behavior is really confusing and need some light on this. Is there any other way to achieve the above functionality?
Its because of IF statement, which is terminated
if(s2l.text.length ==0);
Remove ; from end as
if(s2l.text.length==0)
Hopes that helps

Console Error with CCParallaxNode and crash

I'm getting an error in the console that reads
Assertion failure in -[CCParallaxNode addChild:z:tag:]
This is for the code
CGSize winSize = [[CCDirector sharedDirector] winSize];
node = info;
voidNode = [CCParallaxNode node];
[voidNode addChild:node z:2 parallaxRatio:ccp(0.0f, 1.0f) positionOffset:ccp(info.contentSize.width/2, info.contentSize.height/2 - winSize.height)];
[self addChild:voidNode z:2 tag:kTagNode];
Not very familiar with debugging with the console
Why don't you simply put there a breakpoint and see what is happening ? Every time i had such error the problem was trying to add a nil child to the parent (there is an assertation of it in a addChild method

Actionscript Compiler Problem: Error #1068: Array and * cannot be reconciled

I'm getting a very bizarre callstack in my Flex project (AS3).
Main Thread (Suspended:
VerifyError: Error #1068: Array and * cannot be reconciled.)
I was able to reproduce it using this block of code. If you debug, you'll never get inside "failure" function.
private var testArray:Array = [{},{},{}]
private function run():void {
this.failure({});
}
private function failure(o:Object):void {
for each(var el:Object in testArray) {
o.ids = (o.ids||[]).concat(getArray());
}
}
private function getArray():Array { return [Math.random()]; }
When I run the program, this callstack is one line, but this conole shows a big mess as if it were a segmentation fault:
> verify monkeyTest/failure()
> stack:
> scope: [global Object$ flash.events::EventDispatcher$
> flash.display::DisplayObject$
> flash.display::InteractiveObject$
> flash.display::DisplayObjectContainer$
> flash.display::Sprite$
> mx.core::FlexSprite$
> mx.core::UIComponent$
> mx.core::Container$
> mx.core::LayoutContainer$
> mx.core::Application$ monkeyTest$]
> locals: monkeyTest Object? * * *
Any suggestions? Cheers.
EDIT:
This code does not produce the error:
private function failure(o:Object):void {
for each(var el:Object in testArray) {
o.ids = o.ids || [];
o.ids = o.ids.concat(getArray());
}
}
The problem is here:
o.ids = (o.ids||[]).concat(getArray());
o.ids is type * while [] is Array, so they can't be compared
Change it to:
o.ids = ((o.ids as Array)||[]).concat(getArray());
This error indicates that the ActionScript in the SWF is invalid. If you believe that the file has not been corrupted, please report the problem to Adobe. (see the note at the bottom of that page).
Most verify errors are compiler errors that the compiler failed to capture. Reporting will help to fix them in the next version.
EDIT: Corrected the link, thanks Glenn
I've received this error when creating local variables named "arguments" within a function as well. The compiler doesn't give any warnings, and I've sometimes gotten away with it -- only to have the error pop back up after adding a couple lines. The console gives the crazy error stack, and doesn't let you use the FB debugger in any useful fashion when the error occurs. This happens due to a conflict with the standard "arguments" object available from within any function:
http://as3.miguelmoraleda.com/2009/03/28/actionscript-3-arguments-atributo-arguments-dentro-de-cualquier-funcion-functio/

Resources