Javascript open() function returns undefined

The javascript function open() specs like "fullscreen", "width", "height", seem not to work under Safari while they do under Firefox, Opera and even Explorer. So, I open a popup with : Win=open("<url>","","") and then , I use Win.resizeTo(<width>,<height>) where <width> and <height> was evaluated previously . But I obtain the message : "TypeError : 'undefined' is not an object (evaluating Win.resizeTo)".
I found several problems with Safari (performance different from other browsers), and up to now, I managed to get round the problem. But in this case, I go blank !!!
Please, can you help me to produce a code visible by Safarists ;o)

Beaver13 wrote:
Thank you "etresoft". In fact, I wrote the inappropriate term function, but as I detailed above, I used correctly resizeTo as a method of "what should be a window object". Syntax of the evaluation of this object by open is also correct since the root object window is implicit. Anyway, I tried adding window or this and I obtained the same behavior.
In theory that is true, but it isn't working for you. While I'm quite fond of Javascript, it is a very flexible language and you could have installed any number of 3rd party additions that do all kinds of crazy things with it.
Finally, could you say me how you would  open a popup with given dimensions ?
I normally don't use pop-ups but I have one special case where a page is displayed inside of Google Earth. Google Earth isn't a real web browser, but looks like one, so it needs lots of hacks to get some functionality. When the user clicks an image link, it uses this function to pop-up a new window that redirects itself to the appropriate image URL, successfully downloading the requested image instead of the nasty error message the user would have seen otherwise - and no download. I will add a few extra comments to explain what is going on...
// Pass in the id of the item to download.
function embeddedDownloadItem(id)
     // Center the pop-up in a platform-neutral way.
    var top =
        window.screenTop
            ? window.screenTop
            : window.screenY;
    var left =
        window.screenLeft
            ? window.screenLeft
            : window.screenX;
    top += $(window).height();
    left += $(window).width();
    // Move it over a bit.
    left -= 200;
    // Use the id to construct a selector to
    // find and extract the URL.
    var url = $('#url-' + id).attr('value');
    // Download the file via new window.
    downloadWindow =
        window.open(
            url,
            "Download",
            'top=' + top + ', left=' + left
                + ',width=200,height=100');
    // Close the new window in 5 seconds.
    setTimeout("downloadWindow.close();", 5000);
    // Hide it until that happens.
    window.focus();
As you can see, I am using jQuery which does some of that crazy stuff I mentioned earlier. However, that is not something you really want to live without. This is a special case that just pops up a window, redirects to download an image, and then goes away. I actually recommend not using pop-ups at all because they are too easy to block. In this case, it is running out of Google Earth with doesn't have a pop-up blocker, so I lucked out.
I don't know why your code isn't working. Have you tried the demos at w3schools? They are always very handy.
I agree with you, Safari has the best debugging features, but, I'm a little more circumspect about "the most standard compliant", but maybe I'm wrong.
That is just what I have found. I am not really a web developer, but I have been roped into it. Because I don't really enjoy it, I don't have the same obsession towards perfection that I would elsewhere. If I can get it working in the major browsers, that's good enough for me.
I always build in Safari first. The latest Safari has a few more debugging bells and whistles but is actually a bit harder to use in this aspect than the previous version. I build a "clean-room" version of the site in Safari with no hacks of any kind. Everything works as it should in an "ideal" browser, which just happens to be Safari. The console window and "window.console.log()" are your friends. "Inspect element" is very powerful.
I don't bother with Chrome because it is so similar to Safari. I have never seen a significant difference between the two.
Next up is IE7. Parallels to the rescue. Thankfully, I don't have to support IE6 anymore. IE has some very nice, version-specific hacks that allow you retain some of your sanity. I also use Zend which automatically generates these constructs. I can do something like:
        $this->view->headLink()->appendStylesheet(
            $this->view->baseUrl() . '/css/ie7.css', 'all', 'IE 7');
        $this->view->headLink()->appendStylesheet(
            $this->view->baseUrl() . '/css/ie8.css', 'all', 'IE 8');
which will generate:
<!--[if IE 7]> <link href="/css/ie7.css" media="all" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if IE 8]> <link href="/css/ie8.css" media="all" rel="stylesheet" type="text/css" /><![endif]-->
Zend supports the same thing with Javascript, with a little bit more mess:
        $this->view->headScript()->appendFile(
            $this->view->baseUrl() . '/js_include/warning.js',
            'text/javascript',
            array('conditional' => 'IE 6'));
        $this->view->headScript()->appendScript(
            sprintf(
                'window.onload=function(){e("%s")}',
                $this->view->baseUrl() . '/images'),
            'text/javascript',
            array('conditional' => 'IE 6'));
generates:
<!--[if IE 6]> <script type="text/javascript" src="/js_include/warning.js"></script><![endif]-->
<!--[if IE 6]> <script type="text/javascript">
    //<![CDATA[
window.onload=function(){e("/images")}    //]]>
</script><![endif]-->
In this example, I just pop-up a warning saying IE6 isn't supported at all.
You can do most of the IE7 and IE8 support with the above CSS hacks. If you need to change the structure to support IE, then once it works in IE you have to go back and re-test in Safari.
I have found that IE9 is much more standards-compliant and needs very little help.
Firefox is actually one of the flakier browsers these days - even more so than IE9. I actually have to add a special section of Firefox hacks at the end of my CSS like this:
/* Firefox hacks */
@-moz-document url-prefix()
    #kml_loading,
    #kmz_loading,
    #shapefile_loading
        top: -1px;
Unfortunately, Firefox wasn't known to be a troublemaker like IE so the hacks are more ugly than in IE.

Similar Messages

  • Trace(this["count"+ii]); returns undefined within function

    So I have a function that looks like this.
    fu = function () {
    var count1 = 0;
    var count2 = 0;
    var count3 = 0;
    for (var ii = 1; ii<=3; ii++) {
    trace(this["count"+ii]);
    when it runs it returns
    undefined
    undefined
    undefined
    However,when I declare the variables outside that function,
    like this:
    var count1 = 0;
    var count2 = 0;
    var count3 = 0;
    fu = function () {
    for (var ii = 1; ii<=3; ii++) {
    trace(this["count"+ii]);
    it returns:
    0
    0
    0
    Which is what i want, but I need those variables declared
    locally. SO WHY DOESNT IT WORK THE OTHER WAY????
    Someone please help me, because I'm obviously missing
    something.
    Thanks
    Chris

    "ChrisFlynn" <[email protected]> wrote in
    message news:e50orp$cs5$[email protected]..
    > So I have a function that looks like this.
    >
    > fu = function () {
    > var count1 = 0;
    > var count2 = 0;
    > var count3 = 0;
    > for (var ii = 1; ii<=3; ii++) {
    > trace(this["count"+ii]);
    > }
    > };
    >
    > when it runs it returns
    >
    > undefined
    > undefined
    > undefined
    You can't get a reference to a local variable using this
    method..
    this["count"+ii]);
    That will try to find an object.. movieclip or button with
    that instance name.
    If you need to address variables in a loop it's easiest to
    make them arrays like this..
    fu = function () {
    var count = new Array(4);
    count[1] = 0;
    count[2] = 0;
    count[3] = 0;
    for (var ii = 1; ii<=3; ii++) {
    trace(count[ii]);
    fu();
    tralfaz

  • Javascript Open and Close window

    I am creating a new website and am having problems getting
    the open window and close window to work. I want this window to
    open a new window (NOT a popup window used with the "onload"
    option). I am using an img tag so that when you click on the image
    thumbnail this new window opens. It is my understanding in order to
    use the window.close option, you must have the javascript in the
    header of the html document for the close to work. In the heading
    of the document that contains the link to open a new window I have
    the following:
    <SCRIPT language="JavaScript1.2">
    function popuponclick()
    Cellex = window.open("products/cellex.htm",
    "console","status=1,width=350,height=150");
    function closepopup()
    if(false == cellex.closed)
    cellex.close ();
    else
    alert('Window already closed!');
    </SCRIPT>
    Then I have this in the body:
    <img src="images/thumbnails/dermalogicath.jpg"
    alt="Dermalogica" width="94" height="84" border="0"
    /></a></td>
    <td><a href="products/mdskin.htm"
    onclick="window.open('products/mdskin.htm','mdskin',width=610,height=780,scrollbars=yes') ;return
    false; target="_blank">
    However, I'm getting script errors when opening the window on
    the lines in the body Unterminated error. I have tried using the
    help in Dreamweaver as well as many docs posted, but still cannot
    get this to work. Once I get the script errors resolved, the when
    the window opens, it will not close. I get the message that a
    window is trying to be closed and do I want to close the window
    which closes internet explorer entirely. I'm using IE 7.0 as well
    as foxfire and have the same issue on both. If I use the
    dreamweaver behaviors to call a javascript, it puts "onload" and if
    I change to "onclick" then the script will not work. When I use the
    behavior "open window" it still doesn't work. I'm totally lost as
    to what I'm doing wrong as I have followed about 10 papers all
    using the same instructions.
    Hopefully some one can help me, I'm getting fustrated as this
    seems to be pretty straight forward.
    Thanks, vienie

    Try this on for size:
    I have included two functions.
    windowRebuild() - opens a new window, maximizes it based on the screen size, removes all toolbars, and then closes the old window.
    myLocation(appName, pageName) - builds a url referencing an HTMLDB application, specfic to what server you are currently on. Very useful when you have an application on 3 different servers(dev, test, prod servers), you wouldn't want the server name hardcoded if you plan to export the app to another server.
    Also, you need to be careful when using &APP_ID. I am not completely certain how that is resolved at runtime, but I've found it only works when the javascript is in the HTML Header of a page and not stored in the template of the page.
    <script language="JavaScript1.1" type="text/javascript">
      This functions is for internal application use.
      Examples of myLocation:
      url = myLocation('&APP_ID.', 'APP_PUBLIC_PAGE');
      url = myLocation('MY_APP_ALIAS', 'MY_PAGE_ALIAS');
      url = myLocation('184', '10');
    function myLocation(myApp, myPage){
      var myHost = location.host;
      var newURL;
      newURL = 'http://'+myHost+'/pls/htmldb/f?p='+myApp.toString()+':'+myPage.toString();
      return newURL;
    /*  Function windowRebuild()
    *   This function will open a new window and close the old window.
    *   This function will also maximize the new window and remove all toolbars.
    function windowRebuild(){
       if(window.name != 'myAppWin'){
        var url = myLocation('&APP_ID.', 'PAGE_ALIAS');
        var myWin = window.open(url,'myAppWin','toolbar=0,scrollbars=1,menubar=0,status=1,resizable=1,location=0');
        window.opener = 'x';
        window.close();
       if(window.name == 'myAppWin'){
        window.moveTo(0,0);
        window.resizeTo(screen.availWidth,screen.availHeight);
    </script>Let me know if that works or you need some more explanation.
    Chris

  • PL/SQL function returning a colon delimited list of headings

    Hello,
    Apex version 4.1.0.23. I am editing an existing classic report which has the column heading option set to 'PL/SQL function returning a colon delimited list of headings'. I have been looking for some time but I cannot find where this PL/SQL function is defined. Can any one point me to the right direction? I do not see anything in the documentation either.
    Thanks,
    Usman

    Hi Usman,
    I looked into this issue and found that there's some JavaScript code executed when opening the page with the PL/SQL headings option enabled, or when selecting that option after loading the page, and this JavaScript attempts to set a background color for the column heading fields. Since we only display attributes for up to 100 columns, this JavaScript fails once you have more than 100 columns.
    I would certainly agree with Tony that 60 or 100 columns are a bit much. But there should be some indication why something is not working, even if it's only a message stating that there's only a certain number of columns supported. So I'll log a bug to improve this in APEX 5.0.
    Thanks,
    Marc

  • Javascript sort() function not working correctly

    I have an image gallery that automatically loads via a PHP readdir function which populates an array, and then I have a Javascript sort() function which sorts the images in order numerically. In Chrome and Safari, the images display as numbered in the directory. However, in Firefox and Internet Explorer, they display out of order (firefox) and not at all (ie). Here is the code for the php file: <?
    Header("content-type: application/x-javascript");
    function returnimages($dirname=".") {
    $pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)";
    $files = array();
    $curimage=0;
    if($handle = opendir($dirname)) {
    while(false !== ($file = readdir($handle))){
    $file = basename($file,".jpg");
    echo 'myImg['.$curimage.']="'.$file .'";';
    $curimage++;
    closedir($handle);
    return($files);
    echo 'var myImg=new Array();';
    returnimages()
    ?>
    and here is the code for the javascript sort:
    function sortNumber(a,b)
    return a - b;
    myImg.sort(sortNumber);
    // Tell browser the type of file
    myImgEnd = ".jpg";
    var i = 0;
    // Create function to load image
    function loadImg(){
    document.imgSrc.src = myImg[i] + myImgEnd;
    Any ideas as to why Firefox is behaving this way?

    After you check the box to sort on the column, are you making sure to select a sort order for the same column?
    Earl

  • The scroll function on my mousepad is disabled when viewing a pdf file in firefox version 5.0. The scroll works on the pdf, but not on the other tabs. When the pdf is closed, the scroll function returns to normal. Any ideas?!

    The scroll function on my mousepad is disabled when viewing a pdf file in firefox version 5.0. The scroll works on the pdf, but not on the other tabs. When the pdf is closed, the scroll function returns to normal. Any ideas?!

    Hey thanx for the help, it worked like a charm.
    I think firefox changed the application lay out, as I used to be able to choose my PDF opener from the list at " Adobe Acrobat Forms Document' where I could choose Nitro-PDF reader, but it has now moved all the way to the bottom like you suggested to the obvious place of "Portable Document Format" section.
    If someone didn't tell me , I wouldn't have scrolled all the way down to be able to find it... it really should be with all its cousins up the top...
    Cheers again..

  • Pop up window, and window.opener function using workshop?

    hi,
    pop up window, and window.opener function using workshop?
    hi,
    i am having two folders.
    one folder having
    abc.jpf file,
    test1.jsp
    second folder having
    xyz.jpf
    test2.jsp
    i am using weblogic workshop8.1
    i need to call test2.jsp as pop up window
    from test1.jsp.
    i need to pass value from test1.jsp to test2.jsp
    again i need pass value from test2.jsp to test1.jap
    normal jsp programming we can use window opener
    javascipt function to do above.
    same thing how to us in weblogic workshop?
    any can help?
    thanks,
    jp reddy

    Hi,
    assuming action.do is the action method of ....../folder1/abc.jpf you can try out this in the test1.jsp,
    function openNameHistory(url) {
    var args = "<%= request.getContextPath() %>/folder1/"+url;
         window.showModalDialog(args,'','dialogHeight:320px;dialogWidth:600px;scroll:yes;status:no');
    <netui:anchor href="javascript:openNameHistory('action.do')">Name History</netui:anchor>
    u need not specify the abc.jpf in the url because , workshop allows only one jpf per folder
    hope this helps...
    regards
    shakan

  • Can Function Return more than One Values ??

    Hi Experts,
    I would like to ask you Can Function Return more than one values. I Used Function with Out and In out parameter and its working Fine..
    1. what is harm using Out and In out parameter in function
    2. if we can use Out and In out parameter in Function so what is deffernce between procedure and Function.
    3. Is there any Other Way Though which we can return more the One values in Function.
    Please advice me...
    Thanks
    Umesh Goel

    Yes/No.
    You can return multiple value from function. But, in PL/SQL and not in a SQL.
    The following examples demonstrate that -
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed Mar 28 17:41:15 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create or replace package glob
      2  as
      3    b varchar2(20);
      4    c varchar2(20);
      5  end;
      6  /
    Package created.
    SQL>
    SQL> create or replace function test_mul_out(a in number)
      2  return number
      3  is
      4    cursor c1(eno in number)
      5    is
      6      select ename,job,sal
      7   from emp
      8   where empno = eno;
      9  
    10    rec c1%rowtype;
    11    d  number(10);
    12  begin
    13    open c1(a);
    14    loop
    15      fetch c1 into rec;
    16      exit when c1%notfound;
    17       glob.b:= rec.ename;
    18    glob.c:= rec.job;
    19    d:= rec.sal;
    20    end loop;
    21    close c1;
    22    return d;
    23  end;
    24  /
    Function created.
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    zz  number(10);
      3  begin
      4    select test_mul_out(7777)
      5    into zz
      6    from dual;
      7    
      8    dbms_output.put_line('Ename: '||glob.b);
      9    dbms_output.put_line('Job: '||glob.c);
    10    dbms_output.put_line('Sal: '||zz);
    11  end;
    12  /
    Ename: Avik
    Job: CLERK
    Sal: 3456
    PL/SQL procedure successfully completed.
    SQL> Regards.
    Satyaki De.

  • How to migrate sql server 2000 user defined function returns table

    Hi,
    How do I capture the SQL Server 200 user defined function that returns table? Is this supported in the current version of Oracle Migration Workbench? I am using the latest version - Release 9.2.0.1.0 with SQL SERVER 2000 plug-in.
    I was able to capture the SQL Server 2000 user defined function that returns string and smalldatetime but not the functions return table during the migrate data source stage.
    Thanks in Advance,
    Susan

    Susan,
    This is not currently supported. The next release of the Oracle Migration Workbench (due very soon), will do a better job of catching this mad reporting an error. We are looking into a suitable mapping and have created bug # 2355073 - TABLE DEFINITIONS NOT ACCEPTED FOR TABLE FUNCTIONS to track this issue.
    Once possible solution we are looking into is using the object type to emulate. Here is an example from the bug:
    Original table
    SQL> create table tabela (a number, b number, c number, d number);
    SQL> insert some values...
    SQL> select * from tabela;
    A B C D
    1 1 1 1
    2 2 2 2
    3 3 3 3
    4 4 4 4
    SQL Server 2000 code
    CREATE FUNCTION FUNCRETORNATABELA()
    RETURNS TABLE
    AS
    RETURN SELECT A,B,C,D FROM TABELA
    SELECT A,B,C,D
    FROM FUNCRETORNATABELA()
    ORDER BY A
    Oracle code (workaround)
    SQL> create or replace type MyObjType as object (
    2 a number, b number, c number, d number);
    3 /
    Type created.
    SQL> create or replace type MyTabType as table of MyObjType;
    2 /
    Type created.
    SQL> create or replace function teste return Mytabtype pipelined as
    2 aa MyObjType := MyObjType(null, null, null, null);
    3 cursor c1 is select a,b,c,d from tabela;
    4 begin
    5 open c1;
    6 loop
    7 fetch c1 into aa.a, aa.b, aa.c, aa.d;
    8 exit when c1%NOTFOUND;
    9 pipe row (aa);
    10 end loop;
    11 close c1;
    12 return;
    13 end;
    14 /
    Function created.
    SQL> select * from table(teste);
    A B C D
    1 1 1 1
    2 2 2 2
    3 3 3 3
    4 4 4 4
    SQL> select a, c from table(teste) order by c desc;
    A C
    4 4
    3 3
    2 2
    1 1
    Donal

  • ORA-06503: PL/SQL: Function returned without value

    Hello
    Having a bit of a problem with piplined functions.
    Why does this work :
    SET SERVEROUTPUT ON
    DECLARE
    TYPE SARRAY IS TABLE OF VARCHAR2(4000);
    CURSOR CU IS SELECT * FROM DX_XML_ATTENDANCE WHERE STUD_ID = 107777 AND BASE_ID = 94;
    T_STUD NUMBER(10);
    T_BASE NUMBER(10);
    T_DATE DATE;
    T_MARKS VARCHAR2(1000);
    LEN_MARKS NUMBER;
    PDATE DATE;
    SDATE DATE;
    EDATE DATE;
    SLEN NUMBER;
    WEEKLEN NUMBER;
    INIPOS NUMBER;
    MARRAY VARCHAR2(1000);
    SUBARRAY SARRAY := SARRAY();
    SFILL VARCHAR2(14) := '--------------';
    EPOS NUMBER;
    MY_REC     DX_XML_ATTENDANCE%ROWTYPE;
    BEGIN
    SUBARRAY.EXTEND(17);
    DBMS_OUTPUT.ENABLE(100000000);
    --FOR MY_REC IN CU
    OPEN CU;
    LOOP
         FETCH CU INTO MY_REC;
         EXIT WHEN (CU%NOTFOUND);
    T_STUD := MY_REC.STUD_ID;
    T_BASE := MY_REC.BASE_ID;
    T_DATE := TO_DATE(MY_REC.START_DATE, 'DD/MM/YYYY');
    T_MARKS := MY_REC.MARKS;
    LEN_MARKS := LENGTH(T_MARKS);
    EPOS := LEN_MARKS / 2;
    SDATE := ROUND(TO_DATE(T_DATE), 'W') - 1;
    INIPOS := TO_NUMBER(TO_CHAR(T_DATE, 'D'));
    SLEN := INIPOS + 3;
    PDATE := SDATE;
    EDATE := SDATE + EPOS;
    MARRAY := SUBSTR(T_MARKS, 1, SLEN);
    WEEKLEN := LENGTH(MARRAY);
    IF WEEKLEN < 14 THEN
         MARRAY := SUBSTR(SFILL, 1, 14 - WEEKLEN) || MARRAY;
    END IF;
    SUBARRAY(1) := T_STUD;
    SUBARRAY(2) := T_BASE;
    SUBARRAY(3) := PDATE;
    FOR i IN 4 .. 17 LOOP
         SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
    END LOOP;
    DBMS_OUTPUT.PUT_LINE(SUBARRAY(1)||' '||SUBARRAY(2)||' '||SUBARRAY(3)||' '||SUBARRAY(4)||' '||
         SUBARRAY(5)||' '||SUBARRAY(6)||' '||SUBARRAY(7)||' '||SUBARRAY(8)||' '||SUBARRAY(9)||' '||
         SUBARRAY(10)||' '||SUBARRAY(11)||' '||SUBARRAY(12)||' '||SUBARRAY(13)||' '||SUBARRAY(14)||' '||
         SUBARRAY(15)||' '||SUBARRAY(16)||' '||SUBARRAY(17));
    WHILE PDATE < EDATE LOOP
         PDATE := PDATE + 7;
         MARRAY := SUBSTR(T_MARKS, SLEN + 1, 14);
         WEEKLEN := LENGTH(MARRAY);
         IF WEEKLEN < 14 THEN
              MARRAY := MARRAY || SUBSTR(SFILL, 1, 14 - WEEKLEN);
         END IF;
         FOR i IN 4 .. 17 LOOP
              SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
         END LOOP;
         SUBARRAY(3) := PDATE;
    DBMS_OUTPUT.PUT_LINE(SUBARRAY(1)||' '||SUBARRAY(2)||' '||SUBARRAY(3)||' '||SUBARRAY(4)||' '||
         SUBARRAY(5)||' '||SUBARRAY(6)||' '||SUBARRAY(7)||' '||SUBARRAY(8)||' '||SUBARRAY(9)||' '||
         SUBARRAY(10)||' '||SUBARRAY(11)||' '||SUBARRAY(12)||' '||SUBARRAY(13)||' '||SUBARRAY(14)||' '||
         SUBARRAY(15)||' '||SUBARRAY(16)||' '||SUBARRAY(17));
         PDATE := PDATE + 7;
         SLEN := SLEN + 14;
    END LOOP;
    END LOOP;
    END;
    and this does not :
    CREATE OR REPLACE PACKAGE BODY PARSE_ATTENDANCE AS
    FUNCTION ENUM_MARKS(SEL_SQL IN VARCHAR2)
    RETURN TMP_ATT_DATA_TBL PIPELINED
    IS
    V_SQL           VARCHAR(1000):= SEL_SQL;
    V_CURSOR      SYS_REFCURSOR;
    V_ROW          TMP_ATT_HOLDING:=TMP_ATT_HOLDING(NULL, NULL, NULL, NULL);
    T_STUD           NUMBER(10);
    T_BASE           NUMBER(10);
    T_DATE           DATE;
    T_MARKS      VARCHAR2(1000);
    LEN_MARKS      NUMBER;
    PDATE          DATE;
    SDATE          DATE;
    EDATE          DATE;
    SLEN           NUMBER;
    WEEKLEN      NUMBER;
    INIPOS           NUMBER;
    MARRAY           VARCHAR2(1000);
    SUBARRAY      SARRAY := SARRAY();
    SFILL           VARCHAR2(14) := '--------------';
    EPOS           NUMBER;
    BEGIN
    SUBARRAY.EXTEND(17);
    OPEN V_CURSOR FOR V_SQL;
    LOOP
         FETCH V_CURSOR INTO V_ROW.STUD_ID, V_ROW.BASE_ID, V_ROW.START_DATE, V_ROW.MARKS;
         EXIT WHEN V_CURSOR%NOTFOUND;
    T_STUD := V_ROW.STUD_ID;
    T_BASE := V_ROW.BASE_ID;
    T_DATE := TO_DATE(V_ROW.START_DATE, 'DD/MM/YYYY');
    T_MARKS := V_ROW.MARKS;
    LEN_MARKS := LENGTH(T_MARKS);
    EPOS := LEN_MARKS / 2;
    SDATE := ROUND(TO_DATE(T_DATE), 'W') - 1;
    INIPOS := TO_NUMBER(TO_CHAR(T_DATE, 'D'));
    SLEN := INIPOS + 3;
    PDATE := SDATE;
    EDATE := SDATE + EPOS;
    MARRAY := SUBSTR(T_MARKS, 1, SLEN);
    WEEKLEN := LENGTH(MARRAY);
    IF WEEKLEN < 14 THEN
         MARRAY := SUBSTR(SFILL, 1, 14 - WEEKLEN) || MARRAY;
    END IF;
    SUBARRAY(1) := T_STUD;
    SUBARRAY(2) := T_BASE;
    SUBARRAY(3) := PDATE;
    FOR i IN 4 .. 17 LOOP
         SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
    END LOOP;
    PIPE ROW(TMP_ATT_DATA_OBJ(SUBARRAY(1),SUBARRAY(2),SUBARRAY(3),SUBARRAY(4),
         SUBARRAY(5),SUBARRAY(6),SUBARRAY(7),SUBARRAY(8),SUBARRAY(9),
         SUBARRAY(10),SUBARRAY(11),SUBARRAY(12),SUBARRAY(13),SUBARRAY(14),
         SUBARRAY(15),SUBARRAY(16),SUBARRAY(17)));
    WHILE PDATE < EDATE LOOP
         PDATE := PDATE + 7;
         MARRAY := SUBSTR(T_MARKS, SLEN + 1, 14);
         WEEKLEN := LENGTH(MARRAY);
         IF WEEKLEN < 14 THEN
              MARRAY := MARRAY || SUBSTR(SFILL, 1, 14 - WEEKLEN);
         END IF;
         FOR i IN 4 .. 17 LOOP
              SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
         END LOOP;
         SUBARRAY(3) := PDATE;
         PIPE ROW(TMP_ATT_DATA_OBJ(SUBARRAY(1),SUBARRAY(2),SUBARRAY(3),SUBARRAY(4),
         SUBARRAY(5),SUBARRAY(6),SUBARRAY(7),SUBARRAY(8),SUBARRAY(9),
         SUBARRAY(10),SUBARRAY(11),SUBARRAY(12),SUBARRAY(13),SUBARRAY(14),
         SUBARRAY(15),SUBARRAY(16),SUBARRAY(17)));
         PDATE := PDATE + 7;
         SLEN := SLEN + 14;
    END LOOP;
    END LOOP;
    END ENUM_MARKS;
    END PARSE_ATTENDANCE;
    (This is then called like SELECT * FROM
    TABLE(
    PARSE_ATTENDANCE.ENUM_MARKS(
    'SELECT STUD_ID, BASE_ID, START_DATE, MARKS
    FROM DX_XML_ATTENDANCE WHERE STUD_ID = 107777
    AND BASE_ID = 94'))
    I get the same error, around this section near the bottom :
         PDATE := PDATE + 7;
         SLEN := SLEN + 14;
    Can any one help?

    Here is an example. you are missing an return statement.
    SQL> create or replace type varchar2_table is table of varchar2(10) ;
      2  /
    Type created.
    SQL> show errors
    No errors.
    SQL> create or replace function get_data return varchar2_table pipelined is
      2  begin
      3      pipe row(('Test')) ;
      4  end ;
      5  /
    Function created.
    SQL> show errors
    No errors.
    SQL> select * from table(get_data) ;
    ERROR:
    ORA-06503: PL/SQL: Function returned without value
    ORA-06512: at "KKISHORE.GET_DATA", line 3
    no rows selected
    SQL> create or replace function get_data return varchar2_table pipelined is
      2  begin
      3      pipe row(('Test')) ;
    4 return ;
      5  end ;
      6  /
    Function created.
    SQL> show errors
    No errors.
    SQL> select * from table(get_data) ;
    COLUMN_VAL
    Test
    SQL>

  • Function model undefined

    Hi experts,
    yesterday I tried to open a message mapping definition in Enterprise Services Builder to continue working on it. But instead of showing the mapping definition there was only the error message "Function model undefined". Does anyone know what this means and what causes this error? How can I get back to the mapping again?
    Thanks in advance for all answers!
    Regards,
    Torben

    Hi Torben,
    Are you using any IDoc or RFC in your message mapping? If yes then try to re-import & activate them and then open your Message Mapping.
    Regards
    Suraj

  • Function return single record

    create or replace function etest
    (dep in number)
    return varchar2
    is
    dept number:= 0;
    cursor c1 is
    select deptno
    into dept
    from emp
    where deptno = dep;
    begin
    open c1;
    loop
    fetch c1 into dept;
    exit when c1%notfound;
    end loop;
    close c1;
    return dept;
    end;
    Dear all
    the above function return only one return ,,,but i want to display all record that belong to department 10
    it just i idea that what i want to do....!
    and Secondly
    how i fetch multiple column like i enter department 10 and it give output like
    empno ename sal
    7782 CLARK 2450
    7739 KING 5000
    7934 MILLER 13000
    Thanks to all

    You could use a REF CURSOR:
    PL/SQL 101 : Understanding Ref Cursors
    http://www.oracle-base.com/articles/misc/UsingRefCursorsToReturnRecordsets.php
    or maybe a pipelined function....
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:19481671347143
    http://www.oracle-base.com/articles/9i/PipelinedTableFunctions9i.php
    depending on what client is fetching.

  • Error opening dataset, return code:        8

    Hi,
    I'm passing the information from a txt to a transparente table. The problem is that it throws me the following message: Error opening dataset, return code:        8  .
    When I debug it the first row of information enters to the internal table but after it this erro comes.
    The code is the following:
    DATA: BEGIN OF record,
    data element: TABNAME
            tablename_001(030),
    data element: DESCR40
            des_002(040),
    data element: TYKLA
            tipo_003(015),
    data element: QUANTITY_I
            quan_004(011),
    data element: PRICE
            precio_005(021),
    data element: TOT01
            total_006(017),
          END OF record.
    End generated data section ***
    DATA:
    BEGIN OF i_tabla OCCURS 0,
    dest(40),
    type(15),
    quan(10),
    precio(15),
    tot(15),
    END OF i_tabla.
    PARAMETERS:
    p_user LIKE apqi-userid OBLIGATORY DEFAULT  sy-uname,
    p_fich LIKE rlgrap-filename OBLIGATORY
    DEFAULT: 'C:\Documents and Settings\lseri\My Documents\Book1.txt'.
    START-OF-SELECTION.
      CALL FUNCTION 'UPLOAD'
       EXPORTING
      CODEPAGE                      = ' '
         filename                      = p_fich
         filetype                      = 'DAT'
        TABLES
          data_tab                      = i_tabla
       EXCEPTIONS
         conversion_error              = 1
         invalid_table_width           = 2
         invalid_type                  = 3
         no_batch                      = 4
         unknown_error                 = 5
         gui_refuse_filetransfer       = 6
         OTHERS                        = 7
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      PERFORM open_dataset USING dataset.
      PERFORM open_group.
      LOOP AT i_tabla FROM 2.
    PERFORM bdc_dynpro      USING 'SAPLSETB' '0230'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'DATABROWSE-TABLENAME'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ANLE'.
        PERFORM bdc_field       USING 'DATABROWSE-TABLENAME'
                                      record-tablename_001.
        PERFORM bdc_dynpro      USING '/1BCDWB/DBZSTOCK_TEST' '0101'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'ZSTOCK_TEST-TOTAL'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SAVE'.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-DES'
                                      record-des_002.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-TIPO'
                                      record-tipo_003.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-QUAN'
                                      record-quan_004.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-PRECIO'
                                      record-precio_005.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-TOTAL'
                                      record-total_006.
        PERFORM bdc_dynpro      USING '/1BCDWB/DBZSTOCK_TEST' '0101'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/EBACK'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'ZSTOCK_TEST-DES'.
        PERFORM bdc_dynpro      USING 'SAPLSETB' '0230'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/EBACK'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'DATABROWSE-TABLENAME'.
        PERFORM bdc_transaction USING 'SE16'.
      ENDLOOP.
      PERFORM close_group.
      PERFORM close_dataset USING dataset.
    Please help me!
    Thanks

      open dataset                                                       *
    FORM OPEN_DATASET USING P_DATASET.
      OPEN DATASET P_DATASET
                   FOR INPUT IN TEXT MODE
                   ENCODING DEFAULT.
      IF SY-SUBRC <> 0.
        WRITE: / TEXT-E00, SY-SUBRC.
        STOP.
      ENDIF.
    ENDFORM.
      create batchinput session                                          *
      (not for call transaction using...)                                *
    FORM OPEN_GROUP.
      IF SESSION = 'X'.
        SKIP.
        WRITE: /(20) 'Create group'(I01), GROUP.
        SKIP.
      open batchinput group
        CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = GROUP
                        USER     = USER
                        KEEP     = KEEP
                        HOLDDATE = HOLDDATE.
        WRITE: /(30) 'BDC_OPEN_GROUP'(I02),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ENDIF.
    ENDFORM.
    I'm using these performs because they appeared automatically when the recording became a program.

  • Function Returning Object

    Function Returning Object
    Hi Experts,
    Here is my code,
    -- DROP TYPE TYP_EMP;
    -- DROP TYPE TYP_EMP_OBJ;
    CREATE OR REPLACE TYPE TYP_EMP_OBJ AS OBJECT
        TOTAL       NUMBER,
        ROWINDEX    NUMBER,
        EMPNO       NUMBER,
        ENAME       VARCHAR2(50),
        LOC         VARCHAR2(100)
    CREATE OR REPLACE TYPE TYP_EMP AS TABLE OF TYP_EMP_OBJ;
    CREATE OR REPLACE FUNCTION FUN_GETEMP_LOCATION(pmDeptno IN NUMBER) RETURN VARCHAR2
    AS
        vLocation  DEPT.LOC%TYPE;
    BEGIN
        SELECT LOC INTO vLocation FROM DEPT WHERE DEPTNO=pmDeptno;
        RETURN vLocation;
    END;
    CREATE OR REPLACE FUNCTION FUN_GET_EMP_DETAILS
        pmType      IN NUMBER,
        pmStartPage IN NUMBER,
        pmEndPage   IN NUMBER,
        pmOrderBy   IN VARCHAR2
    RETURN TYP_EMP PIPELINED
    AS
        vString VARCHAR2(100);
        TYPE vRefCursor IS REF CURSOR;
        Cur  vRefCursor;  
        Rec  TYP_EMP_OBJ := TYP_EMP_OBJ(NULL,NULL,NULL,NULL,NULL);
    BEGIN
        IF pmType IS NULL THEN
            SELECT 0,NULL,NULL,NULL,NULL INTO Rec.TOTAL,Rec.ROWINDEX,Rec.EMPNO,Rec.ENAME,Rec.LOC FROM DUAL;
            RETURN;
        END IF;
        IF pmType =1 THEN
        OPEN Cur FOR
        'SELECT * FROM(
            SELECT
                COUNT(*) OVER(),
                ROW_NUMBER() OVER('||pmOrderBy||') ROW_INDEX,
                EMPNO,
                ENAME,
                FUN_GETEMP_LOCATION(EMP.DEPTNO) LOC
            FROM EMP)T
        WHERE T.ROW_INDEX BETWEEN '||pmStartPage||' AND '||pmEndPage;
        ELSE
        OPEN Cur FOR
        'SELECT * FROM(
            SELECT
                COUNT(*) OVER(),
                ROW_NUMBER() OVER('||pmOrderBy||') ROW_INDEX,
                2,
                ENAME,
                FUN_GETEMP_LOCATION(EMP.DEPTNO) LOC
            FROM EMP)T
        WHERE T.ROW_INDEX BETWEEN '||pmStartPage||' AND '||pmEndPage;
        END IF;   
    LOOP
        FETCH Cur INTO Rec.TOTAL,Rec.ROWINDEX,Rec.EMPNO,Rec.ENAME,Rec.LOC;
            EXIT WHEN Cur%NOTFOUND;
        PIPE ROW(Rec);
    END LOOP;
    CLOSE Cur;
    RETURN;
    END;
    SELECT * FROM TABLE(FUN_GET_EMP_DETAILS(NULL,1,10,'ORDER BY EMPNO DESC'));
    SELECT * FROM TABLE(FUN_GET_EMP_DETAILS(1,1,10,'ORDER BY EMPNO DESC'));
    SELECT * FROM TABLE(FUN_GET_EMP_DETAILS(2,1,10,'ORDER BY EMPNO DESC'));
    Executing First Query
    Actually Whats happening on Executing first Query, it does not return as specified
    SELECT 0,NULL,NULL,NULL,NULL INTO Rec.TOTAL,Rec.ROWINDEX,Rec.EMPNO,Rec.ENAME,Rec.LOC FROM DUAL;
    It just returning null;
    Executing Second Query
    It return correctly.
    Executing Third Query
    It return correctly.
    Can anyone suggest how to work out like this?
    Thanks,
    Dharan V

    You dint pipe the row if pmType is NULL
    CREATE OR REPLACE FUNCTION FUN_GET_EMP_DETAILS
        pmType      IN NUMBER,
        pmStartPage IN NUMBER,
        pmEndPage   IN NUMBER,
        pmOrderBy   IN VARCHAR2
    RETURN TYP_EMP PIPELINED
    AS
        vString VARCHAR2(100);
        TYPE vRefCursor IS REF CURSOR;
        Cur  vRefCursor;  
        Rec  TYP_EMP_OBJ := TYP_EMP_OBJ(NULL,NULL,NULL,NULL,NULL);
    BEGIN
        IF pmType IS NULL THEN
            SELECT 0,NULL,NULL,NULL,NULL INTO Rec.TOTAL,Rec.ROWINDEX,Rec.EMPNO,Rec.ENAME,Rec.LOC FROM DUAL;
            pipe row(rec); ----------------<<<<----------------- This is required
            RETURN;
        END IF;
        IF pmType =1 THEN
        OPEN Cur FOR
        'SELECT * FROM(
            SELECT
                COUNT(*) OVER(),
                ROW_NUMBER() OVER('||pmOrderBy||') ROW_INDEX,
                EMPNO,
                ENAME,
                FUN_GETEMP_LOCATION(EMP.DEPTNO) LOC
            FROM EMP)T
        WHERE T.ROW_INDEX BETWEEN '||pmStartPage||' AND '||pmEndPage;
        ELSE
        OPEN Cur FOR
        'SELECT * FROM(
            SELECT
                COUNT(*) OVER(),
                ROW_NUMBER() OVER('||pmOrderBy||') ROW_INDEX,
                2,
                ENAME,
                FUN_GETEMP_LOCATION(EMP.DEPTNO) LOC
            FROM EMP)T
        WHERE T.ROW_INDEX BETWEEN '||pmStartPage||' AND '||pmEndPage;
        END IF;   
    LOOP
        FETCH Cur INTO Rec.TOTAL,Rec.ROWINDEX,Rec.EMPNO,Rec.ENAME,Rec.LOC;
            EXIT WHEN Cur%NOTFOUND;
        PIPE ROW(Rec);
    END LOOP;
    CLOSE Cur;
    RETURN;
    END;Edited by: Karthick_Arp on Dec 24, 2009 2:12 AM

  • Index array problems with tcp open function

    Hello,
    I am using the TCP open function to check if an IP or hostname is online. I do this with an input array specifying the IP/hostname as well as the port. This doesn't seem to work as expected. After using highlight execution I noticed that the port on index 1 gets to the tcp open function after the IP/hostway on index 0 so the tcp open function seems to execute without a port and returns an error. If I set the port as a constant it works fine. Anyone have any ideas how I could fix this? Thank you in advance.
    Attachments:
    iface-detect_online.vi ‏12 KB

    After some more testing I think I am wrong on the assumption that the values are getting there at different times. I think the problem is that the port is a text string and needs to be numeric instead. Is there a way to make index 1 on the array numeric while leaving the hostname a string?
    On edit: after figuring out why this wasn't working I was able to fix this problem by using the decimal string to number function. Thanks to anyone that reviewed this.
    Message Edited by Pawel Kowalski on 09-22-2008 11:12 AM

Maybe you are looking for