Hi,

Can you please give some example code on how to handle api_datasource.getRequiredColumnViolations? I want to loop through the violations and log a message on all violations, displaying the datasource and columns that have violations.

Thanks alot, Michiel A.

asked 09 Jul '12, 06:38

Michiel%20A's gravatar image

Michiel A
5161648
accept rate: 13%


Hi Michiel,

Here is a sample code to get a datasource's required column violations. The code below shows popup messages for each violation.

  procedure getvialotions is
    v_violations_tt api_datasource.tt_requiredColumnViolation;
  begin
    v_violations_tt := api_datasource.getrequiredcolumnviolations('datasourceName');

    for i in 1..v_violations_tt.count loop
      api_application.showpopupmessage('violated row id : ' || v_violations_tt(i).row_id);
      for j in 1..v_violations_tt(i).columns_t.count loop
        api_application.showpopupmessage('column name : ' || v_violations_tt(i).columns_t(j));
      end loop;
    end loop;
  end;

Regards, Samet

link

answered 09 Jul '12, 07:49

Samet%20Basaran's gravatar image

Samet Basaran
1372
accept rate: 24%

Thanks Samet !

(09 Jul '12, 08:41) Michiel A

Hi Michiel,

This happens because you have our development schema. Samet suspected this could happen and was trying to find out when we sent you the schema. We are releasing 1.1 this week. It will have this problem solved.

(09 Jul '12, 14:04) Yalim K. Gerger ♦♦

Just for anybody wanting to use this example: There is a little bug in the second loop. It is missing .name tx fieldname at the end. So the second call to showpopupmessage should be:

api_application.showpopupmessage('column name : ' || v_violations_tt(i).columns_t(j).name_tx);

Another thing to take note of is that the second loop not only give me the name of the missing required column, but also 3 empty names..

Samet, you have an idea what these empty name_tx values are?

(09 Jul '12, 14:38) Michiel A

Hi Michiel,

Sorry for inconvenience, my sample code is for v1.0. But we sent you our development version and it seems we sent you it while we were changing the API. With the new version v1.1 you will not get those empty names.

The code below shows how you can use the API in v1.1.

procedure getvialotions is
    v_violations_tt api_datasource.tt_requiredColumnViolation;
  begin
    v_violations_tt := api_datasource.getrequiredcolumnviolations('datasourceName');

    for i in 1..v_violations_tt.count loop
      api_application.showpopupmessage('violated row id : ' || v_violations_tt(i).row_id);
      for j in 1..v_violations_tt(i).columns_t.count loop
        api_application.showpopupmessage('column name : ' || v_violations_tt(i).columns_t(j).name_tx);
        api_application.showpopupmessage('column type : ' || v_violations_tt(i).columns_t(j).datatype_cd);
      end loop;
    end loop;
  end;

Regards, Samet

link

answered 10 Jul '12, 00:10

Samet%20Basaran's gravatar image

Samet Basaran
1372
accept rate: 24%

Hi Samet, no problem.

Thanks for the explanation.

Michiel

(10 Jul '12, 00:36) Michiel A
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:

×16
×5
×1

Asked: 09 Jul '12, 06:38

Seen: 1,646 times

Last updated: 10 Jul '12, 00:36


© Copyright Gerger 2017