How to change error message in apex5.0 - oracle-apex

In apex5.0, I have a page Item Ref_no define as number and a dynamic action associated with it that fill other Page Items.
when entered an incorrect ID getting below error message:
Ajax call returned server error ORA-01403: no data found for Execute PL/SQL Code.
Is there a way to customise this error to 'Enter Correct Reference'

It's hard to say without seeing the pl/sql, or log, but it seems as though you need to add some error handling within that code.
E.g.
Declare
l_temp number;
Begin
SELECT 1
INTO l_temp
FROM dual
WHERE 1 = 0;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20000, 'Enter Correct Reference');
End;
Oracle doc on error handling

On the process you have Error section when you can put text if operation fail. In case you try to put data in report you have section No Data Found in region atributes.

Related

how do i Disable AJAX error window for constraint?

I have an app where an AJAX error window pops up when a constraint for data. I want this AJAX error to not show up. It only does it for one of the fields in the table and not others with similar constraints. Is there a way to get rid of this window?
The error usually appears when a certain process fails due to your constraint exception.
You can either supply an own error message (this will simply replace the constraint message) or handle the exception yourself, like this:
declare
lExConstraint exception;
pragma exception_init(lExConstraint, -2290);
begin
insert into your_table(columnx) values (1);
exception
when lExConstraint then
-- do your handling here
null;
end;
In this example, I created an alias for ORA-02290, a check constraint exception - but it could be used in a similar way for all other exceptions. Note that you should not leave the code like this, as it will simply swallow the exception and do nothing.

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).

Error: This operation is not allowed when there are no records displayed. Please execute a query that returns

I have added the following code in the WebApplet_Load of Service Request Applet.It's giving me the above error once, I tries to open the SR screen from the application.
try
   {
      var currBC = this.BusComp();
      with (currBC)
      {
ActivateField("Restrict_drop_down");
ClearToQuery();
//BC.SetViewMode(3);;
TheApplication.SetProfilAttr("SR Type", GetFieldValue("Restrict_drop_down"));
        ExecuteQuery(ForwardBackward);
      }
   }
   catch (e)
   {
      TheApplication().RaiseErrorText(e.errText);
   }
Any idea on how to solve the issue?
You cannot do GetFieldValue when the BC is in Query mode. You have just done ClearToQuery, so you have to execute the query first, check for FirstRecord(); and then do a GetFieldValue();
Also, during the WebApplet load the first BC query is not finished running. It might not be the best place to write this code.
Please check with a siebel expert on your team, such kind of code needs to be placed carefully.

How to deal with possible duplicates in an Ember store?

My Ember apps retrieves model objects from an API that can contain duplicates on successive calls.
I want to store my objects like this:
myController.store.createRecord('myModel', myModelObject).save()
Unfortunately, when a duplicate occurs, I get the following error in the console:
Error: Assertion Failed: The id XXX has already been used with another record of type MyApp.MyModel.
(fonction anonyme)ember.js:3866
I couldn't figure a way to recover gracefully from that error. I tried:
myController.store.createRecord('myModel', myModelObject).save().catch(myFailureCallback)
but the failure callback doesn't get called and the error is the same.
You could check to see if the record is already loaded into the store
http://emberjs.com/api/data/classes/DS.Store.html#method_recordIsLoaded
store.recordIsLoaded('myModel', myModelObject.get('id'))

Debug Assertion Failed Expression: GetInterface()!=0 error when writing to database table

Im working on a MFC project which communicates specific table on my SQL Server. But when I try to make delete query I get Debug Assertion Failed error message at runtime and also nothing is deleted when I check my table.
This is the code where I think the error is:
<pre> HRESULT hr;
hr=COLEDBTESTSetAccessor::OpenDataSource();
if(FAILED(hr))
MessageBox(NULL,"Connection Failed\n","",MB_OK);
else
MessageBox(NULL,"Connected\n","",MB_OK);
CString strString;
strString.Append("DELETE FROM PHONE_NUMBERS WHERE ID=");
CString strParam;
strParam.Format("%d",nId);
strString.Append(strParam);
MessageBox(NULL,(LPCSTR)strString,"",MB_OK);
hr=this->Open(m_session,strString); <code>
The same also happens with Update and Insert Query but the table records are updated.
Can anyone tell me where is my mistake?
Thank you. :)
I can not see from what base class you derive you class. I assume you have a Command object.
So what happens is that you already performed an operation with an Open call. But after an open you need a Close operation before you can use the command again with a new statement and Open operation.
Look at the m_spCommand member.