Creating and displaying Varrays in Apex 4.1

Hi,
I am creating quite a sophisticated database, which has to support relations between different tables. In order to implement that, I've decided to use user-defined datatype - a varray which consists of 100 integers (and only of that) that will contain ID's to different rows in different tables. Since it is a user-defined datatype I have problems with using it in Application Express :)
First question: Is there any way to make this simple datatype 'readable' for Apex? In each application I create it shows that it is 'an unsupported datatype'. Maybe I should define something more than just varray construction - the way Apex should read and edit it etc ?
Second question: How can I implement a function that will read the IDs in the varray and transform them into names to which that IDs correspond? I would like an application to show full name of an organization (ex. "ABC Corporation") instead of its ID. I tried to put some part of code that takes up the name of an organisation in a row with given ID into +"Source"+ form in the +"Edit page item"+, however Apex doesn't seem to get the fact that the data is in different table. Any ideas? :)
I will be grateful for any help since it is an urgent case :]

KamilGorski wrote:
I would happily do that if only I had more time to study SQL and learn it properly :) Unfortunately, our start-up company has no time and money at the moment to allow me to do so.Then isn't using technologies that no one knows rather a strange decision?
But coming back to your solution - it still works only if user inputs only one product quality. Let's say that user has chosen 3 qualities and the 'SELECTED_QUALITIES' collection looks like that:
n001 = 1,
n002 = 3,
n003 = 5
And since the SELECT query you have created compares pq.quality_id only to n001, it returns all the products that have the quality no 1 - not all the products that have all three selected qualities - 1, 3 and 5. Of course, we can change the 'EXISTS' condition and add more 'OR' conditions like that:
where pq.quality_id = q.n001
or pq.quality_id = q.n002
or pq.quality_id = q.n003But it has few flaws - first we assume that we know the number of qualities user has selected - 3 (and we don't know that), You've misunderstood. SQL is row based. To handle multiple values, we create more rows, not additional columns. In your preferred terms, the result of any query is an <i>m</i>&times;<i>n</i> array of columns and rows, where the number of columns <i>m</i> is fixed, and the number of rows <i>n</i> varies according to the query predicates.
It is not necessary to know the number of selected qualities, simply create a row in the collection for each selected quality to give a set of selected qualities.
The SELECTED_QUALITIES collection should look like:
N001
   1
   3
   5
secondly the query will return all the products that have one of the three selected qualities (and we want products that have all three qualities). That wasn't really clear from the information previously given, but it's certainly possible. With <tt>product_qualities(product_id, quality_id)</tt> as a primary/unique key, and with no duplicates in the selected qualities, a solution is the set of all products with the selected qualities, where the number of qualities matched for each product equals the number of qualities selected, as in this example:
SQL> create table products (
  2      product_id    integer       primary key
  3    , product_name  varchar2(30)  not null);
Table created.
SQL> create table qualities (
  2      quality_id    integer       primary key
  3    , quality_name  varchar2(30)  not null);
Table created.
SQL> create table product_qualities (
  2        product_id  integer   not null references products
  3      , quality_id  integer   not null references qualities,
  4      constraint product_qualities_pk primary key (
  5            product_id
  6          , quality_id))
  7    organization index;
Table created.
SQL> create index product_qualities_ix2 on product_qualities (
  2      quality_id
  3    , product_id);
Index created.
SQL> insert all
  2    into products (product_id, product_name) values (1, 'widget')
  3    into products (product_id, product_name) values (2, 'thingummy')
  4    into products (product_id, product_name) values (3, 'whatsit')
  5    into products (product_id, product_name) values (4, 'gizmo')
  6    into products (product_id, product_name) values (5, 'gadget')
  7    into products (product_id, product_name) values (6, 'contraption')
  8  select * from dual;
6 rows created.
SQL> insert all
  2    into qualities (quality_id, quality_name) values (1, 'green')
  3    into qualities (quality_id, quality_name) values (2, 'silver')
  4    into qualities (quality_id, quality_name) values (3, 'shiny')
  5    into qualities (quality_id, quality_name) values (4, 'furry')
  6    into qualities (quality_id, quality_name) values (5, 'digital')
  7    into qualities (quality_id, quality_name) values (6, 'hd')
  8    into qualities (quality_id, quality_name) values (7, 'wireless')
  9  select * from dual;
7 rows created.
SQL> insert all
  2    into product_qualities (product_id, quality_id) values (1, 1)
  3    into product_qualities (product_id, quality_id) values (1, 3)
  4    into product_qualities (product_id, quality_id) values (2, 2)
  5    into product_qualities (product_id, quality_id) values (2, 4)
  6    into product_qualities (product_id, quality_id) values (3, 1)
  7    into product_qualities (product_id, quality_id) values (3, 3)
  8    into product_qualities (product_id, quality_id) values (3, 5)
  9    into product_qualities (product_id, quality_id) values (4, 2)
10    into product_qualities (product_id, quality_id) values (4, 4)
11    into product_qualities (product_id, quality_id) values (4, 6)
12    into product_qualities (product_id, quality_id) values (5, 2)
13    into product_qualities (product_id, quality_id) values (5, 3)
14    into product_qualities (product_id, quality_id) values (5, 5)
15    into product_qualities (product_id, quality_id) values (6, 1)
16    into product_qualities (product_id, quality_id) values (6, 3)
17    into product_qualities (product_id, quality_id) values (6, 5)
18    into product_qualities (product_id, quality_id) values (6, 7)
19  select * from dual;
17 rows created.
SQL> commit;
Commit complete.For the purposes of creating a quick and simple example outside of APEX, I'm using a temporary table instead of the SELECTED_QUALITIES APEX collection. For various reasons collections work better in APEX than GTTs and are the preferred approach for temporary storage.
SQL> create global temporary table selected_qualities (
  2    n001 integer)
  3  on commit delete rows;
Table created.With one quality selected, we get all the products having that quality:
SQL> insert into selected_qualities (n001) values (1);
1 row created.
SQL> insert into selected_qualities (n001) values (1);
1 row created.
SQL> select
  2            p.product_id
  3          , p.product_name
  4  from
  5            products p
  6           join product_qualities pq
  7             on p.product_id = pq.product_id
  8           join selected_qualities sq
  9             on pq.quality_id = sq.n001
10  group by
11            p.product_id
12          , p.product_name
13  having
14             count(*) = (select count(*) from selected_qualities);
PRODUCT_ID PRODUCT_NAME
      1 widget
      6 contraption
      3 whatsitThese products all have the next quality added, so continue to be returned:
SQL> insert into selected_qualities (n001) values (3);
1 row created.
SQL> select
  2            p.product_id
  3          , p.product_name
  4  from
  5            products p
  6           join product_qualities pq
  7             on p.product_id = pq.product_id
  8           join selected_qualities sq
  9             on pq.quality_id = sq.n001
10  group by
11            p.product_id
12          , p.product_name
13  having
14             count(*) = (select count(*) from selected_qualities);
PRODUCT_ID PRODUCT_NAME
      1 widget
      6 contraption
      3 whatsitThen as additional qualities are selected, the result set is progressively reduced:
SQL> insert into selected_qualities (n001) values (5);
1 row created.
SQL> select
  2            p.product_id
  3          , p.product_name
  4  from
  5            products p
  6           join product_qualities pq
  7             on p.product_id = pq.product_id
  8           join selected_qualities sq
  9             on pq.quality_id = sq.n001
10  group by
11            p.product_id
12          , p.product_name
13  having
14             count(*) = (select count(*) from selected_qualities);
PRODUCT_ID PRODUCT_NAME
      6 contraption
      3 whatsit
SQL> insert into selected_qualities (n001) values (7);
1 row created.
SQL> select
  2            p.product_id
  3          , p.product_name
  4  from
  5            products p
  6           join product_qualities pq
  7             on p.product_id = pq.product_id
  8           join selected_qualities sq
  9             on pq.quality_id = sq.n001
10  group by
11            p.product_id
12          , p.product_name
13  having
14             count(*) = (select count(*) from selected_qualities);
PRODUCT_ID PRODUCT_NAME
      6 contraption

Similar Messages

  • 2 Custom Fields-create and display

    In addition to the standard fields available within the Whou2019s Who service, we need to create and display 2 custom fields within the employee search functionality in ESS. 
    Can someone walk me through the steps please?

    Hello,
    There are 2 sections of search available.
    1 is normal search and 1 is advances search.
    Well for advanced search you can very much follow my earlier reply.
    And you can also have a look at below thread...
    ESS Who is Who - Add search criteria
    I guess you want to add extra field in normal search.
    I am not sure how to do it....as Siddharth (In link I pasted above) says that he himself have never seen any changes in normal search.......
    But still you can give below method a try.....
    http://wiki.sdn.sap.com/wiki/display/profile/ESS%2bPersonal%2bInformation%2bUI%2benhancement%2bwithout%2bmodification?bc=true

  • How do I create and display a text file?

    Hello friends,
    I am trying to create a simple unix like operating system with very basic functionality. I have a hard time trying to create a "mktext" file and actually display the contents of the text file with the "cat" command. For example:
    // If I type
    $$ mktext test.txt "We are one"
    $$ Text file is created
    // And if I type
    $$ cat test.txt
    // This line will appear
    $$ "We are one" // Only the contents of the test.txt will display.
    That is what I want to do, but currently stuck. I would appreciate any help and suggestions. Thanks...

    This will do it:
    import java.io.*;
    import java.util.*;
    public class Osys
         BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
    public Osys()
         try
              while(true)
                   System.out.print("$$ ");
                   String s = keyboard.readLine();
                   analize(s);
         catch(Exception e){}
    private void analize(String s)
         if (s.trim().equals("")) return;
         StringTokenizer st = new StringTokenizer(s," ");
         if (!st.hasMoreTokens()) return;
         String s1 = st.nextToken();
         if (s1.equals("cat"))
              if (st.hasMoreTokens()) readIt(st.nextToken().trim());
              System.out.println("");  
              return;
         if (s1.equals("mktext"))
              if (st.hasMoreTokens()) writeIt(st.nextToken().trim(),s);
              System.out.println("");
              return;
    // write
    private void writeIt(String file, String line)
         BufferedWriter writer;
         StringTokenizer st = new StringTokenizer(line,"\"");
         if (st.countTokens() != 2) return;
         st.nextToken();
         try
              writer  = new BufferedWriter(new FileWriter(file));
                 writer.write(st.nextToken()); 
              writer.close();
              System.out.println("$$ Text file is created");  
         catch (IOException e)
               System.out.println(""+e);  
    // read
    private void readIt(String file)
         BufferedReader reader = null;
         String         read   = null;
         try
             reader = new BufferedReader(new FileReader(file));
              while( (read = reader.readLine()) != null)
                  System.out.println("$$ "+read);  
              reader.close();
         catch (IOException e)
               System.out.println(""+e);  
    public static void main(String[] args)
         new Osys();
    }Noah

  • How to create and display items

    Hi All,
    I tried to create an item within the EBS. Using the standard user mfg/welcome, I found the section "Item Manager - Create Engineering Items" and "Item Manager - Create Production Items". Or these objects the same kind of items with just different attributes or are they completely different objects stored in separate tables? I was able to create such an item, but trying to find/display it again using "Item Manager - Item Simple Search" failed with the message "Error - No Organization Access for User". This is weird, write only access ;-). What roles or permissions are necessary to search and display items?
    btw: Is it possible to create an user who is allowed to do everything? Right now, I'm using sysadmin to configure stuff, but this user is obviously not good to create items, BOMs... since the "Item Manager" and many other things are not available here. I would like to have a users who can do almost everything to "explore" the EBS!
    Thanks a lot,
    Konrad

    Hi Konrad;
    What is your EBS version?
    Please check oracle manufacturing guide and Oracle Applications User's Guide from below links to can find answer for your questions
    For r12.1.1:
    http://download.oracle.com/docs/cd/B53825_01/current/html/docset.html
    For r12:
    http://download.oracle.com/docs/cd/B40089_10/current/html/docset.html
    For r11:
    http://download.oracle.com/docs/cd/A60725_05/r11_doc.htm
    Regard
    Helios

  • User feedback- Creating and Displaying web page

    Hi,
    does anyone know how I could create a html-page and display this in a browser from my applet?
    I have created an applet that after preforming its task has information that should be displayed to the user. Prefferably this should be displayed as a normal html web page so that the user can use the browsers print and/or save functions. So my idea is to create an html page (located in RAM, not on disk), open a browser to this page and let the user worry about the rest. Any suggestions on how to do this?

    You can open any url in a new browser window from applet:
    try{
    URL url = new URL("...");
    applet.getAppletContext().showDocument(url,"_blank");
    catch(MalformedURLException e){}
    So html (jsp) page with applet info should be located/created on the server, and applet must send info to server before that. It can be sent as parameter of url ("http://.....?param=..."). I use this approach.

  • Problem with creating and displaying images in a thread

    Hi everyone,
    i need some bit of advice (of course otherwise i wouldn't write anything here). My situation is like this:
    I have a JFrame where the user can enter a string. Then a file that corresponds to this string is read and the information is stored in objects, then these two objects (there are always 2 objects per file) are passed to an ImageCreator class that creates one image with the information found in each object. So per file there are always two images created. Now the thing is that after creating the images i need to display them for 10 seconds each, but as it takes about 2 seconds to create each image i would like to start showing the first one already while the second one is still being created. As i am not really experienced with threads i wonder what would be the best way to manage something like this. Here is a little bit of code, which is still in a rather pseudo code state...if(checkPattern(scanField.getText()) &&
          fc.getFile(createFilename(scanField.getText())) != null)
          BufferedImage img = null;
          ImageDisplay display = new ImageDisplay(scanField.getText(), this);
          for (int i=1; i<3; i++) {
          Info info = tReader.readTelegramForOneInfo(createFilename(scanField.getText()));
          if(i==1) 
            info.setError(ew.getProperty(info.getMTNr1(), info.getLack()));
          if(i==2)
            info.setError(ew.getProperty(info.getMTNr2(), info.getLack()));
            iCreator.setHashtable(info);
            iCreator.setWhichMatNr(i);
            img = iCreator.createImage(false);
            if(i == 1)
                //here i would like to start showing the first image
                display.showImage(img);
          //thats an older version where i displayed both images after they had been
          //created.
          //Thread t = new Thread(new ImageDisplay(scanField.getText(), this));
          //t.start();
          //here i would like to show the second image.
          display.showImage(img);
          scanField.setText("");
        else
           doSomethingElse();
        }I hope you can help me.
    Thanks!

    All actual drawing opertations should occur on the dispatcher thread. When the first image is ready you could use SwingUtiltiies.invokeLater() to place a task on the dispatcher thread to draw the image e.g.
    final BufferedImage img = iCreator.createImage(false);
    if(i == 1)
      SwingUtilities.invokeLater(new Runnable() {
         public void run() {
           display.showImage(img);
       });(Both the variables uses in run() must be final.
    But it's probably better to have a java.awt.Component of some kind for each image to be displayed, and whose paint method does the actual rendering, if the image is ready (is blank otherwise). Then, when the image is ready you need only call repaint on the components.

  • How to load PDF files into oracle database and display them in APEX

    Hi All,
    We have a requirement for loading the Loading PDF files (lots of PDf files) to the oracle database and then display the PDF files in the Oracel APEX report.
    So that User can view the PDF files. Our current APEX verison is 3.2..
    Please let me know how to implement it and where to find the sample application!
    Thanks in advanced!
    Jane

    Thanks Tony for your quick response!
    We need to load a lot of PDfs (history + current).
    I have a questions about the SQL loader. I am trying to insert a pdf file into a table by following the oracle loading sample:
    http://download.oracle.com/docs/cd/B10501_01/text.920/a96518/aload.htm
    Example Data File: loader2.dat
    This file contains the data to be loaded into each row of the table, articles_formatted.
    Each line contains a comma separated list of the fields to be loaded in articles_formatted. The last field of every line names the file to be loaded in to the text column:
    Ben Kanobi, plaintext,Kawasaki news article,../sample_docs/kawasaki.txt,
    But i don't know to where should I put my pdf file on the server.
    for example:
    ,../sample_docs/kawasaki.txt,
    Where is the file 'kawasaki.txt'??
    I try my local path, it didn't work. like c:\temp.
    then I loaded teh PDf file into our server(/findev20/olmtest/orafin/11.5.7/olmtestcomn/temp) , and In my data file. I put the path
    1, pdf_emp1,../findev20/olmtest/orafin/11.5.7/olmtestcomn/temp
    but I got the error: the system can not find the file specified.
    Where should I put the PDf files on the server and how to specify the path in the data file?
    Thanks!
    Jane

  • Create and display an Image within a object?

    Hi,
    I'd like to make objects that (among other things) hold a GIF-image. Then I would like for these objects to be able to display themselves. Like this:
    public class MyApplet extends Applet {
    private Tree tree;
    public void init() { tree = new Tree();}
    public void paint(Graphics g) { tree.display(g);}
    class Tree {
    private Image im;
    public Tree() { //create im here from file "tree.gif" ??}
    public void display(Graphics g) { //display im here??}
    Any idea how I can do this? Which librarymethods could I use and how?
    Thanx,
    JB

    What you could do is have theTree class extend JLabel and include a constuctor like
    public Tree(String filename)
    /*path is a class variable*/
    path=filename;
         ImageIcon ii= new ImageIcon(filename);
         this.setIcon(ii);
    then in a JFrame you could do something like
    Tree theTree = new Tree("/images/picture.gif");
    add(theTree);
    or use a layout Manager. Hope this helped

  • How to create and display in page 2

    Hi,
    A new requirement has come for me ... the existing form for statement of account is using  RF140-WRSHB (foreign currency) to display the open items of the customer ... but when a customer is having two different currency... then the users want to display the local currency on the first page & on the second page they want to display foreign currency + local currency
    for e.g ... Cust A has open item in SGD($160)  & USD ($100)...
    then on page 1
    Foriegn currency USD - $100 <-- This is already coming ...
    on page 2.
    Currency   |   local currency
    100  USD  |   160   SGD <-- I need to display this... please tell me how can I do this ...
    Thank You,
    SB.

    Hi Eswar,
    It is taking currency Key from BSID ... & BSID here for that customer is having 2 currency Key ... one for SGD & one for USD ... the only way to get the right currency key in page 2 is through the right BELNR ... but how do I write .. Select WAERS where
    bukrs = "____ " and
    kunnr = "____" and
    belnr =  "____".
    This is what is written for Page 1...
    &ULINE(71)&,,
    <K>Doc.,,Doc.,,Invoice,,Text,,Amount in</>
    <K>Date,,Type.,,Number,,,,&BSID-WAERS&</>
    &ULINE(71)&

  • Creating and Displaying a Table in Cyrstal Reports X

    I'm wondering if it is possible to create a table that will allow grouping of date and have the titles of each grouping across the top of a table in Crystal Reports.
    I want dates across the top. And Site Location down the side. It's easy enough to group down the side. But I can not fathom how to have the field populate across the top and allow grouping like in a table.
    Is this possible?

    Daniel,
    I did a couple of reports similiar to what you are referring to with Cross-tab reports.
    Hope that helps, if not let me know.

  • Creating and filling JTables dynamically

    Hello,
    How can I create and display a JTable dynamically in a Java application? In my application, I retrieve rows from a database and therefore I don't know in advance how many rows I need for my JTable (using the tablemodel). I tried to solve the problem in the following way:
    1)start op applicatie with a JTable with 0 rows (screen is grey, only columns are visible)
    2)run query and count number of rows.
    3)create new JTable based on number retrieved in step 2 and tried to put it onto the screen.
    4)run query again and fill table with values retrieved from query
    The bottleneck so far is step 3. I can create a new table but I don't manage to put it onto the screen (i tried already the repaint() method)
    Thanx for you help
    Frits

    Sure, no problem. Assume you've retrieved the following result from the database:First Name     Last Name     Age
    John           Doe           25
    Jane           Doe           27
    Joe            Smith         40
    Mary           Smith         19You create your JTable as like this:Vector headings = new Vector();
    Vector rows = new Vector();
    Vector cells = null;
    JTable table = null;
    for(int x=0; x< resultSize; x++){//resultSize is the size of your result
      cells = new Vector(); //Cells together will represent a row
      cells.add(yourResult.getTheFirstColumnForRowX()); //Pseudo-code
      cells.add(yourResult.getTheSecondColumnForRowX()); //Pseudo-code
      cells.add(yourResult.getTheThirdColumnForRowX()); //Pseudo-code
      //Now place those cells into the rows vector
      rows.add(cells);
    //Create the JTable
    table = new JTable(rows, headings);This code is not tested and is meant to give you an idea of how the concept can be applied. Hope it helps.

  • How can i create n display label dynamically

    Hai, I want to create a label dynamically, meant when i pressed a button once one label generated for the next click of button another label. like this,
    so i need to know how to create and display a label.
    regards

    Hi,
    Armin's solution already answers your question.
    Create a value attributre CreatLabel..of type boolean and set it to false in init.
    Then in the button's action handler ,set it to true.
    And write this code in wdDoModifyView.
    In wdDoModifyView():
    if ( wdContext.currentContextElement().getCreateLabel() ){  /* create new label with automatic ID */  IWDLabel label = (IWDLabel) view.createElement(IWDLabel.class, null);  /* add label to some container */  someContainer.addChild(label);  /* reset creation flag */  wdContext.currentContextElement().setCreateLabel(false);}
    You should not create view element outside wdDoModifyView. So we write this in the wdDoModify view..a nd control when it is executed.. by means of setting CreateLabel value attribute..
    Regards
    Bharathwaj
    Message was edited by: Bharathwaj R

  • Downloading and displaying xml file

    Hai,
    Can anybody help me??
    My problem is :
    I want to create and display an XML file once i run my program in background.My display would be in internet explorer.
    Note that i could not use GUI_DOWNLOAD, because my execution is in background.I am looking for the one to replace GUI_DOWNLOAD.
    I used OPEN DATASET statement, but the file, which is opening is not in XML format. it is displaying only in SAP. I want the display in explorer.
    My requirement is urgent...
    Hope u will respond.
    Regs
    Gransen

    Hi Buddy...try with class <b>CL_GUI_FRONTEND_SERVICES</b>. Goto SE24 and type the class mentioned above. In this class you can find a method called <b>GUI_DOWNLOAD</b>.
    If it is not working try
    <b>CALL TRANSFORMATION</b>
    call transformation (`ID`) source (your internal table) result XML xml_string.
    Kindly reward points if you find it useful.
    Regards,
    Satyesh T

  • Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotfo

    Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotform.com, but this form doesn't search the site, instead it sends me an e-mail. Do you have a solution for me? Thanks.

    Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotform.com, but this form doesn't search the site, instead it sends me an e-mail. Do you have a solution for me? Thanks.

  • How to create a Shuttle box in Apex with simple copy and move option..

    I want to create a shuttle box in Apex with simple copy option. the demo application I downloaded from oracle had a two level selection query option which I dont need and was not even compatible with my version. All I need is a way to shuttle single query values between two multiple select lists. I could not find any demo.
    My Apex version 2.1 with XE
    query : select distinct fieldid d, fieldid r from field order by 1
    What kind of buttons do I need.. ? submitting or url redirecting ?

    Hello,
    >>
    The demo is not working in my apex 2.1 as I mentioned in the post.
    >>
    Not working is not enough of a description to help you out. I assume that what you mean is it won't install into XE since the demo was built in 2.2 and uses some 2.2 specific technology for the install.
    The way to get around that issue like I said was to get a free workspace on apex.oracle.com install the demo application there and then using some cutting and pasting recreate the demo app in your XE instance.
    Carl

Maybe you are looking for