apex_application.g_print_success_message variable does not get set - oracle-apex

On my DML form I have a delete process that calls a PL/SQL function:
DECLARE
err_code NUMBER;
BEGIN
my_package.delete_record(id => :P2_ID,error_code => err_code);
IF NVL(TO_NUMBER(err_code),0) = 0 THEN
apex_debug.message('Record deleted');
apex_application.g_print_success_message := 'Record deleted';
END IF;
END;
Somehow apex_application.g_print_success_message does not get set and displayed even though everything else works as I see a debug message being written. Can anyone help my figure this one out? Could it be because I have multiple processes on the page?

Check for the process point of yout page process, the success message won't appear on a "Before Header" process point.
If that doesn't help, check out the apex.message API.
apex.message.showPageSuccess( "Record deleted" );

Only the last assignment are shown.
So check if you have an empty assignment to it somewhere else.
apex_application.g_print_success_message:='';
Also see if you by any chance have filled in a space in one of the page processes "Success Message"

Updating that variable directly is not supported.
You can define a hidden item, set that within your processes
:P0_MY_HIDDEN_ITEM := 'Process outcome';
Then include the following in the success message attribute to your final process.
Errors can be added using apex_error package.

Related

How to give link for users to Download the Csv Template in Apex

I have an requirement to give link to users in Apex Application to download the csv template.
I have created a link and created an process code as below for the users to download the csv file, But its showing some json error,
begin
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="test.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
-- Loop through all rows in EMP
for x in (select WORKSPACE,GROUPNAME,MEMBERS from CSV_NON_DYNAMIC_TEMPLATE where FILENAME='test.csv')
loop
-- Print out a portion of a row,
-- separated by commas and ended by a CR
htp.prn(x.WORKSPACE ||','|| x.GROUPNAME ||','||x.MEMBERS|| chr(13));
end loop;
-- Send an error code so that the
-- rest of the HTML does not render
htmldb_application.g_unrecoverable_error := true;
end;
Even i code the process code to on load process, then its working the excel is creating but other than that no buttons or process code not working on the same page.
thanks
First, saying you're getting "some json error" is not helpful. It helps to put the exact error message you're getting in your question.
Second, you probably have this process running at the Process step. Apex is submitting the page via Ajax, your process runs, returns an error to the page and you're getting your message.
Change your process to run at the Before Header point and change it so it has a server side condition of "Request = Value" and make the value "DOWNLOAD".
Change your button's action to Redirect to Page In This Application, and set the link to your page number with a request of "DOWNLOAD" (that's under the advanced section).

c++ quickfix failure to send

I'm having an unexpected issue with a c++ quickfix client application using FIX 4.4. I form marketdatarequest and populate it and then call send which returns true. The message is not found in the message or event log files.
No error seems to be reported - what could be happening?
FIX44::MarketDataRequest request(FIX::MDReqID(tmp)
, FIX::SubscriptionRequestType('1')
, FIX::MarketDepth(depth)); // 0 is full depth
FIX::SubscriptionRequestType subType(FIX::SubscriptionRequestType_SNAPSHOT);
FIX44::MarketDataRequest::NoRelatedSym symbolGroup;
symbolGroup.set(FIX::Symbol(I.subID));
request.addGroup(symbolGroup);
FIX::Header &header = request.getHeader();
header.setField(FIX::SenderCompID(sessionSenderID));
header.setField(FIX::TargetCompID(sessionTargetID));
if (FIX::Session::sendToTarget(request) == false)
return false;
My FixConfig looks like:
[DEFAULT]
HeartBtInt=30
ResetOnLogout=Y
ResetOnLogon=Y
ResetOnDisconnect=Y
ConnectionType=initiator
UseDataDictionary=Y
FileLogPath=logs
[SESSION]
FileLogPath=logs
BeginString=FIX.4.4
DataDictionary=XXXXX
ConnectionType=initiator
ReconnectInterval=60
TargetCompID=tCompID
SenderCompID=sCompID
SocketConnectPort=123456
SocketConnectHost=XX.XX.XXX.XX
SocketConnectProtocol=TCP
StartTime=01:05:00
EndTime=23:05:30
FileLogPath=logs
FileStorePath=logs
SocketUseSSL=N
thanks for any help,
Mark
Mark, just couple of notes not really related to your question but which you may found useful:
you dont have to explicitly set TargetCompId/SenderCompId for each message, engine will do it for you.
Do not place logic into callbacks(like you did with market data subscription in onLogon). Better create additional thread which will consume events from you listener, make decisions and take an action.

scalatra < squeryl < select ALL | Always

I want to read elements from the database and return them as JSON objects.
Scalatra is set up to return JSON.
Databaseschema is created.
Players are added.
The following code seems to be the main problem:
get("/") {
inTransaction {
List(from(MassTournamentSchema.players)(s => select(s)))
}
}
I get the following error:
"No session is bound to current thread, a session must be created via Session.create and bound to the thread via 'work' or 'bindToCurrentThread' Usually this error occurs when a statement is executed outside of a transaction/inTrasaction block "
I want to do it right so simply adding something like "Session.create" may not really be the right way.
Can anyone help a scalatra-noob? :-)
I think that your comment is on the right track. The inTransaction block will bind a JDBC connection to a thread local variable and start the connection on it. If the select doesn't occur on the same thread, you'll see an error like the one your received. There are two things I would suggest that you try:
Start your transaction later
List(inTransaction {
from(MassTournamentSchema.players)(s => select(s))
})
I'm not familiar with Scalatra's List, but it's possible that it's accepting a by-name parameter and executing it later on a different thread.
Force an eager evaluation of the query
inTransaction {
List(from(MassTournamentSchema.players)(s => select(s)).toList)
}
Here the .toList call will turn the Query object Squeryl returns into a Scala List immediately and guard against any lazy evaluation errors caused by later iteration.

Ember .observe() returns callback twice when used with query-params

http://jsbin.com/vowup/2
If I click change to random, program logs in console twice.
For some strange reason it works ok when setting revision variable to string, but logs twice for number or any other kind of variable
Change your code to this and the answer will become clear:
toggleHistory: (function() {
console.log(this.get("revision"));
}).observes("revision")
You will see output like:
0.7038348997011781
"0.7038348997011781"
Your numbers are being coerced to strings. That is caused by this line:
queryParams: ["revision"]
Query system is listening to changes and converting every new value into string, so it could appear as part of the URL. That's why you get two changed events.

Accessing Apex_application.g_fXX values from a stored procedure

I woul like to access Apex_application.g_fXX values from within the database stored procedure, either by passing the whole array as an input parameter or by reading session state from within the database. Is this possible? My reason for trying to do this is that I want to move all heavy processing to the database.
TIA, Tamas
Sure, why wouldn't it work?
CREATE OR REPLACE PACKAGE "APXPA_TEST" IS
PROCEDURE process_something;
PROCEDURE process_something2(i_values IN apex_application_global.vc_arr2);
END "APXPA_TEST";
/
CREATE OR REPLACE PACKAGE BODY "APXPA_TEST" IS
PROCEDURE process_something
IS
BEGIN
FOR i in 1..apex_application.g_F02.COUNT
LOOP
apex_debug_message.log_message('processing '||apex_application.g_f02(i)||'...');
END LOOP;
END;
PROCEDURE process_something2(i_values IN apex_application_global.vc_arr2)
IS
BEGIN
FOR i IN 1..i_values.COUNT
LOOP
apex_debug_message.log_message('processing '||i_values(i)||'...');
END LOOP;
END;
end "APXPA_TEST";
/
I made a page with a tabular form based on EMP. I created a page process with process point On Submit - After Computations and Validations, before the MRU.
apxpa_test.process_something;
apxpa_test.process_something2(apex_application.g_f02);
G_F02 holds ENAME
Now run the page and enable debug. Then just submit the form (you don't need to edit anything), and go to view debug. Pick the last entry. Scroll to the point where it goes over the page processes: you'll see the output there. (i only used deptartment 10)
Processes - point: AFTER_SUBMIT
...Process "some process" - Type: PLSQL
...Execute Statement: begin apxpa_test.process_something; apxpa_test.process_something2(apex_application.g_f02); end;
processing KING...
processing CLARK...
processing MILLER...
processing KING...
processing CLARK...
processing MILLER...
...Process "ApplyMRU" - Type: MULTI_ROW_UPDATE
...Process "ApplyMRD" - Type: MULTI_ROW_DELETE