Dear Formspider Team,

How I can prevent of showing api_error message in my application. When I do api_datasource.executeQuery and in case when it returns no row api_error will show message "Datasource "DOCUMENT1" has no current row." I understand why it message shows up, but I don't want this error message be displayed. How I can achive this?

Best Regards, Tihomir

asked 16 Nov '15, 04:40

Zigfrid's gravatar image

Zigfrid
111
accept rate: 0%


Hi Tihomir,

We generally wrap any statement that might raise this exception in the code with an if statement such as:

if api_datasource.getCurrentRowID('myDatasource1') is not null then
   --do some processing
end if;

Kind Regards,
Yalim

link

answered 16 Nov '15, 07:53

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

Hi Yalim,

That what you say don't work in my case. Here is example of code: api_datasource.setBindVar('EMPLOYEES1.firstName', api_component.getValueTx('searchPanel.firstName')); api_datasource.executeQuery('EMPLOYEES1');

If api_component.getValueTx('searchPanel.firstName') return name of employee which I don't have in my database formspider will show error "Datasource "EMPLOYEES1" has no current row."

Your sugestion was to wrap my statement into: if api_datasource.getCurrentRowID('myDatasource1') is not null then --do some processing end if;

In than case my code whould be like this: api_datasource.setBindVar('EMPLOYEES1.firstName', api_component.getValueTx('searchPanel.firstName'));

 if api_datasource.getCurrentRowID('myDatasource1') is not null then
    api_datasource.executeQuery('EMPLOYEES1');
 end if;

And the result of this would be that executeQuery will never get executed if I don't have current row.

I want to execute that query, but if my executeQuery statement returns no row I don't want to display error message.

Best Regards, Tihomir

link

answered 16 Nov '15, 08:29

Zigfrid's gravatar image

Zigfrid
111
accept rate: 0%

Hi Tihomir,

There are two more ways to handle error messages. I'll write them both. You can use whichever one suits you the best

1) You can handle the exception immediately when it is raised

In your PL/SQL code where the exception occurs, you can use:

exception
  when api_exception.e_NoCurrentRow then
     --your exception handling code
..
..
end;

2) You can use the On Error handler of the Formspider application you are building. You can find this event in the applications dialog box under events tab. If you assign an action to this event, any unhandled exception will always trigger this event and execute your code.

In the PL/SQL code of the action that you assigned to the On Error Event you can find out which event occured using the api_exception.getException function. You can read more about this API at this link.

The record this API will return have the value e_noCurrentRow in its exceptioncode_tx column. The downside of this approach is that any code under the line where the exception occurs will not execute.

Hope this helps.

Kind Regards,
Yalim

link

answered 19 Nov '15, 10:00

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×5
×4

Asked: 16 Nov '15, 04:40

Seen: 696 times

Last updated: 19 Nov '15, 10:00


© Copyright Gerger 2017