Function to step through a View

Hello All, I need to create a function that reads a view and exports the data into a fixed field formatted file. I believe I need to step through the view, and for each record, extract each field, rpad it to a specified length and concatenate the fields back together into a new record, perhaps dumping each new record into a temp table and once done, export the table into a file. Please let me know if this reasoning sounds logical and/or is the best approach. Thanks.

If you want something a little more generic to take any query (whether from a view or regular tables), something along these lines will do...
As sys user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
/As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                     ,p_dir IN VARCHAR2
                                     ,p_header_file IN VARCHAR2
                                     ,p_data_file IN VARCHAR2 := NULL) IS
  v_finaltxt  VARCHAR2(4000);
  v_v_val     VARCHAR2(4000);
  v_n_val     NUMBER;
  v_d_val     DATE;
  v_ret       NUMBER;
  c           NUMBER;
  d           NUMBER;
  col_cnt     INTEGER;
  f           BOOLEAN;
  rec_tab     DBMS_SQL.DESC_TAB;
  col_num     NUMBER;
  v_fh        UTL_FILE.FILE_TYPE;
  v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
BEGIN
  c := DBMS_SQL.OPEN_CURSOR;
  DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
  d := DBMS_SQL.EXECUTE(c);
  DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
  FOR j in 1..col_cnt
  LOOP
    CASE rec_tab(j).col_type
      WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
      WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
      WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
    ELSE
      DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
    END CASE;
  END LOOP;
  -- This part outputs the HEADER
  v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
  FOR j in 1..col_cnt
  LOOP
    v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
  END LOOP;
  --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
  UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
  IF NOT v_samefile THEN
    UTL_FILE.FCLOSE(v_fh);
  END IF;
  -- This part outputs the DATA
  IF NOT v_samefile THEN
    v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
  END IF;
  LOOP
    v_ret := DBMS_SQL.FETCH_ROWS(c);
    EXIT WHEN v_ret = 0;
    v_finaltxt := NULL;
    FOR j in 1..col_cnt
    LOOP
      CASE rec_tab(j).col_type
        WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                    v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
        WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                    v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
        WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                    v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
      ELSE
        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
      END CASE;
    END LOOP;
  --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
    UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
  END LOOP;
  UTL_FILE.FCLOSE(v_fh);
  DBMS_SQL.CLOSE_CURSOR(c);
END;This allows for the header row and the data to be written to seperate files if required.
e.g.
SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
PL/SQL procedure successfully completed.Output.txt file contains:
empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
Adapt to output different datatypes and styles are required.

Similar Messages

  • Updating a Base Table through a View having UNPIVOT function.

    Hi,
    I have a requirement of updating a Base Table through a View.
    This View has the query using a UNPIVOT function for displaying the columns of the Base tables in rows.
    I need to update/insert into/delete the Base Table by accessing the View (The user doesn't have an access to the Base Table, hence the DML's on the View).
    Following is the table I've created:-
    CREATE TABLE PERSON_DETAILS
      PID            VARCHAR2(10 BYTE),
      FIRSTNAME      VARCHAR2(1000 BYTE),
      LASTNAME       VARCHAR2(1000 BYTE),
      PHONENUMBER    VARCHAR2(1000 BYTE),
      ADDRESS1       VARCHAR2(1000 BYTE),
      ADDRESS2       VARCHAR2(1000 BYTE),
      COUNTRY_CODE   VARCHAR2(1000 BYTE),
      LANGUAGE_CODE  VARCHAR2(1000 BYTE),
      EMAIL          VARCHAR2(1000 BYTE)
    )The sample values are inserted in this table through the below script:-
    insert into person_details values ('1','XYZ','ABC','1234567890','India','Asia','IN','EN','[email protected]');
    insert into person_details values ('2','XYZ2','ABC2','1234567890','India','Asia','IN','EN','[email protected]');The code for the view is as below:-
    CREATE OR REPLACE FORCE VIEW PERSON_DETAILS_VIEW
       PID,
       CD_NAME,
       CD_VALUE
    AS
       SELECT "PID", "CD_NAME", "CD_VALUE"
         FROM person_details UNPIVOT INCLUDE NULLS (cd_value
                             FOR cd_name
                             IN  (firstname AS 'First Name',
                                 lastname AS 'Last Name',
                                 phonenumber AS 'Phonenumber',
                                 address1 AS 'address1',
                                 address2 AS 'address2',
                                 country_code AS 'Country Code',
                                 language_code AS 'Language Code',
                                 email AS 'Email') );Below are the values from the view:-
    PID CD_NAME         CD_VALUE
    1    First Name       XYZ
    1    Last Name       ABC
    1    Phonenumber  1234567890
    1    address1         India
    1    address2         Asia
    1    Country Code   IN
    1    Language Code EN
    1    Email               [email protected]
    2    First Name       XYZ2
    2    Last Name       ABC2
    2    Phonenumber  1234567890
    2    address1         India
    2    address2         Asia 
    2    Country Code   IN
    2    Language Code EN
    2    Email               [email protected] user would fire some statement like below:-
    update person_details_view
    set cd_value = 'US' where CD_NAME = 'IN'The above statement should update the base table PERSON_DETAILS.
    I understand I can write an INSTEAD OF trigger but I do not know what logic to write in the trigger so that the requirement gets fulfilled.
    My Oracle Version
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0    Production
    TNS for Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionAny help would be highly appreciated.
    Thank You,
    Ankit Khare.
    Edited by: Ankit_Khare84 on Jun 28, 2012 2:47 PM

    it is definitively possible with an instead of trigger.
    for Example:
    create or replace
    TRIGGER ioft_person
    INSTEAD OF UPDATE
    ON person_details_view
    FOR EACH ROW
    declare
    firstname1  person_details.firstname%type;
    BEGIN
                  SELECT firstname_new into firstname1
                  FROM   (SELECT pid, cd_name, cd_value
                          FROM  
                                  select * from person_details_view where (pid, cd_name) not in (select :new.pid, :new.cd_name from dual)
                                  union all
                                  select :new.pid, :new.cd_name, :new.cd_value from dual
                  PIVOT  ( max(cd_value) AS new FOR (cd_name) IN
                                                          ('First Name' AS firstname,
                                                            'Last Name' as lastname,
                                                            'Phonenumber' as phonenumber,
                                                            'address1' as address1,
                                                            'address2' AS address2,
                                                            'Country Code' as country_code,
                                                            'Language Code' as language_code,
                                                            'Email' as email
                  )  where pid = :old.pid;
      UPDATE person_details
      SET firstname = firstname1
      WHERE pid = :old.pid;
    END ioft_role_perm;and than run
    update person_details_view
    set cd_value = 'X|X' where cd_name = 'First Name' and pid=1The logic is: you must convert back the view through pivoting

  • True about updates through a view

    hi frds
    i just need the right answer for the choices mentioned below with explanation
    plz help me
    What is true about updates through a view?
    A. You cannot update a view with group functions.
    B. When you update a view group functions are automatically computed.
    C. When you update a view only the constraints on the underlying table will be in effect.
    D. When you update a view the constraints on the views always override the constraints on the underlying tables.

    And a very tricky only it is.
    Peter, you are correct that view constraints are not enforced in the sense of PKs and FKS, but there are two other view constraints that are enforced.
    SQL> CREATE TABLE t AS
      2  SELECT rownum id, object_name
      3  FROM all_objects
      4  WHERE rownum < 11;
    Table created.
    SQL> CREATE VIEW t_read AS
      2  SELECT * FROM t
      3  WITH READ ONLY;
    View created.
    SQL> CREATE VIEW t_check AS
      2  SELECT * FROM t
      3  WHERE mod(id,2) = 0
      4  WITH CHECK OPTION;
    View created.
    SQL> CREATE VIEW t_nocheck AS
      2  SELECT * FROM t
      3  WHERE MOD(id, 2) = 0;
    View created.
    SQL> INSERT INTO t_read VALUES (100, 'READ ONLY');
    INSERT INTO t_read VALUES (100, 'READ ONLY')
    ERROR at line 1:
    ORA-01733: virtual column not allowed here
    SQL> INSERT INTO t_check VALUES (100, 'EVEN ID');
    1 row created.
    SQL> INSERT INTO t_check VALUES (101, 'ODD ID');
    INSERT INTO t_check VALUES (101, 'ODD ID')
    ERROR at line 1:
    ORA-01402: view WITH CHECK OPTION where-clause violation
    SQL> INSERT INTO t_nocheck VALUES(100, 'EVEN ID');
    1 row created.
    SQL> INSERT INTO t_nocheck VALUES(101, 'ODD ID');
    1 row created.
    SQL> UPDATE t_check SET id = 201
      2  WHERE id = 2;
    UPDATE t_check SET id = 201
    ERROR at line 1:
    ORA-01402: view WITH CHECK OPTION where-clause violation
    SQL> UPDATE t_nocheck SET id = 201
      2  WHERE id = 2;
    1 row updated.The WITH READ ONLY constraint bars all changes to the view. The WITH CHECK OPTION stops any changes that would make the record invisible to the view. It is essentially a CHECK constraint on the view.
    John

  • Stepping through a poorly formatted xml file

    Hi, this forum worked a charm earlier so I'm hoping it will go 2 for 2.
    Through a httpservice I'm reading an XML file into a ArrayCollection. Because the XML is so poorly formatted I'm having to write some very sloppy code just to step through 20 results. I have no control over the XML.
    XML Example (can be anywhere from 0 to 20 results):
    <results>
        <game>
            <type>game</type>
            <id>321</id>
            <name>gamename</name>
            <image>i34d.png</image>
        </game>
        <character>
            <type>character</type>
            <id>1123</id>
            <name>john</name>
            <image>sds.png/image>
        </character>
        <game>
            <type>game</type>
            <id>432</id>
            <name>examplename</name>
            <image>g2dss.png</image>
        </game>
    </results>
    Each result can be one of 7 types (I've done only 2, game and character, in my example). The order of them I really want to preserve in my ArrayCollection as it's very relevant.
    Here is the (very) sloppy way I'm currently loading each result into my AC:
    //container array
    var ac2:ArrayCollection = new ArrayCollection;
    //I do a block like this for EVERY results type. Meaning 7 in total...
    if (service2.lastResult.response.results.character) {
         var characterAC:ArrayCollection = new ArrayCollection;
         if (service2.lastResult.response.results.character is ArrayCollection) {
         //there is more than 1 entry
         characterAC = service2.lastResult.response.results.character as ArrayCollection;
         } else {
              //There is only 1 entry. Need to MAKE it an ArrayColleciton
              characterAC = new ArrayCollection([service2.lastResult.response.results.character]);
            //Add all characters to AC
         ac2.addAll(characterAC);
    The two major problems with this code is: 1, it's stupidly bloated and 2, ac2 no longer maintains the order of the XML response. First it puts all <character> into my AC, then it puts all <game> into AC. So on and so forth.
    In my head I'm trying to do something like this:
    ac2 = service2.lastResult.response.results.* as ArrayCollection;
    That would then load all results (regardless of type) into an ArrayCollection. I'm guessing a solution is not that simple...
    In an Ideal world, whoever created the XML api would just call each result <result> instead of the stupid type tags it currently uses.
    I hope all that makes sense.
    Regards,
    Zaph.

    @Zaph31,
    Why not use an XMLListCollection instead of an ArrayCollection?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init();">
        <mx:XML id="iWouldntHaveCodedXMLLikeThat" xmlns="">
            <results>
                <game>
                    <type>game</type>
                    <id>321</id>
                    <name>gamename</name>
                    <image>i34d.png</image>
                </game>
                <character>
                    <type>character</type>
                    <id>1123</id>
                    <name>john</name>
                    <image>sds.png</image>
                </character>
                <game>
                    <type>game</type>
                    <id>432</id>
                    <name>examplename</name>
                    <image>g2dss.png</image>
                </game>
            </results>
        </mx:XML>
        <mx:XMLListCollection id="xmlListColl" />
        <mx:Script>
            <![CDATA[
                private function init():void {
                    xmlListColl.source = iWouldntHaveCodedXMLLikeThat.children();
            ]]>
        </mx:Script>
        <mx:DataGrid id="dg" dataProvider="{xmlListColl}">
            <mx:columns>
                <mx:DataGridColumn dataField="type" />
                <mx:DataGridColumn dataField="id" />
                <mx:DataGridColumn dataField="name" />
                <mx:DataGridColumn dataField="image" />
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    Peter

  • Can I instruct the debugger to step through triggered events as well?

    I have the following statements in my code:
    Public Class Class1
    Public Shared Sub TestClass()
    Dim ExlApp As Excel.Application = CType(AddinModule.CurrentInstance, TimeTracker.AddinModule).ExcelApp
    ExlApp.Range("A1").Value = "Test"
    ExlApp.Range("A2").Value = "When I press F11 the debugger jumps to this row from test"
    End Sub
    End Class
    When I step through the debugger, it jumps directly from the first statement above to the second. But inbetween those rows some events are triggered. Is there any way to tell the debugger to not jump over these events but instead step into these events?

    Hi JP3O,
    Since it is related to the specific VB app, to really repro this issue, could you share me the sample?
    >>But inbetween those rows some events are triggered.
    Maybe you could add breakpoints in your events, and then debug your whole app with "Start debugging (F5)", and make sure that the code is really called (the breakpoints were hit)or it has been called before the code shared in your thread.
    Or it is related to the JIT:
    https://msdn.microsoft.com/en-US/library/7ad07721(v=vs.100).aspx 
    If the breakpoints in evens are not hit, please check whether you could get any message if you put the mouse on the breakpoints. Maybe it is related to the symbols loaded or others.
    If you get any latest information, please feel free to let me know.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Code works when I step through it, not when run real-time though.

    Hi,
    I have a bit of code, a trivial problem in fact, that has completely defeated me.
    private int recFibonacci(int N, long starTime) {
            long totalTime = System.currentTimeMillis() - starTime;
            if(N <= 0) return -3;  //negatives not allowed
            try {
                if (N < 2) {
                    return N;
                } else {
                    if (totalTime <= 1500) { //if it takes longer than 15 seconds, end.
                        N = recFibonacci(N - 2, starTime) + recFibonacci(N - 1, starTime);
                    } else {
                        return -1;//return if taking too long
            } catch (StackOverflowError ex) {
                return -2;//return if overflow
            return N;
    //This is the user accessible function for the recursive fibonacci method.
    //It calls the private fibonacci function and passes it a startTime value.
    //This is so that the startTime is only set at the user's call, not each time the
    //function recurses.
        public int recFibonacci(int N) {
            setTime();
            int retN = this.recFibonacci(N, getStartTime());
            if (retN == -1) {
                System.out.println("Calculation is is taking too long, try a non-recursive solution.");
                return -1;
            if (retN == -2) {
                System.out.println("Stack overflow, recursed too deeply.  Try a non-recursive solution, or a smaller number.");
                return -2;
            if (retN == -3){
                System.out.println("Fibonacci sequence is undefined for negative numbers.");
                return -3;
            return retN;
        }From the driver I call the single argument method.
    When I debug and step through the code it runs perfectly. If the number is large enough to take a little while to execute,i get the appropriate error message. Also, if the number causes a stack overflow, I get that message as well.
    When I run the code (realtime not stepping) I always get a strange return value if N is too large. Its always a different value, and I never receive the error code. I am at a complete loss to explain this discrepency.
    Any ideas?

    Seems to me your problem could be the same as this poster's:
    [Problem With Recursion|http://forum.java.sun.com/thread.jspa?threadID=5270481]
    db

  • Stepping through the code

    Using Eclipse, latest build, on a Mac, I'm stepping through the FlexPMD code.  I enter in the debug configuration the parameters "-s <src dir>" and "-o <output dir>".  Those arguments are successfully passed into FlexPMD but when the FileUtils tries to locate the Flex source files, I have some ActionScript, *.as, files in the <src dir>, I get an error:
    Exception in thread "main" net.sourceforge.pmd.PMDException: sourceDirectory does not contain any Flex sources (Specify the source directory in relative (not absolute))
        at com.adobe.ac.pmd.files.impl.FileUtils.getFlexFiles(FileUtils.java:107)
        at com.adobe.ac.pmd.files.impl.FileUtils.computeFilesList(FileUtils.java:52)
        at com.adobe.ac.pmd.FlexPmdViolations.computeFiles(FlexPmdViolations.java:128)
        at com.adobe.ac.pmd.FlexPmdViolations.computeViolations(FlexPmdViolations.java:92)
        at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.computeViolations(AbstractFlexPmdEngine.ja va:153)
        at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.executeReport(AbstractFlexPmdEngine.java:1 36)
        at com.adobe.ac.pmd.commandline.FlexPMD.startFlexPMD(FlexPMD.java:115)
        at com.adobe.ac.pmd.commandline.FlexPMD.main(FlexPMD.java:69)
    Since the 'args' parameter in the main function is getting the '-s' and '<src dir>' parameters, I'm not sure what is it complaining.  I don't see anything in the source code what those parameters are being discarded.
    Any ideas?
    Thanks
    Brenda

    Hi Brenda!
    I don't think I understood your problem.
    The error you mentioned means that the source folder you specified does not contain any Flex source files (*.as, *.mxml)
    Are you saying that you have a folder with Flex source files, and that those files are not picked up by FlexPMD?
    Any FlexPMD clients (command-line, Maven, Ant, ...) are using AbstractFlexPmdEngine which uses the class FlexPmdParameters
    I don't see any reasons why your source folder would be discarded.
    Best
    Xavier

  • How to Step through Scripts that are sent to other Adobe Apps?

    A newbie question. In the ExtendScript Toolkit, I'm examining a script that uses BridgeTalk to send a script to Photoshop. I understand how to step through and examine the variables and functions that execute within the Bridge application. But how can I step through and examine the variables that are sent to the Photoshop application? The script executes without breaking as soon as the BridgeTalk script is sent.
    Thanks
    Help Getting Started with Bridge Scripting 

    I not sure that you can… What you may be able to do in some cases… is comment out the sending of the bridgetalk message and write the script constructed string message body to the toolkit console… That you might be able to cut and paste to a new script window and run with #target photoshop your other option would be to add lines $.writeln( variable ); at the relevant places in the message body construction…

  • Step Through java.* Classes With JDB

    Here is a simple program:
    public final class HelloWorld {
      private HelloWorld() {
      public static void main(String[] args) {
        System.out.println("Hello, World!");
    }I compile it with the -g option, and run it in jdb:
    javac -g HelloWorld.java
    jdb HelloWorld
    I set a breakpoint in the main function...now I'm wondering why I can't step through the String constructor (or whatever magic happens behind the String literal syntax) and the println method calls. When I use step, it just skips over them! I find that I can set breakpoints in library methods, and use list to see the source, but as soon as I step it flies out of the library method and back to mine. Does anybody know what gives? Is it because the libraries aren't compiled with the -g option???

    Thanks for your quick input. It seems you're right about the libraries. I made a dummy class compiled with the -g:none option, added some more lines in the first class (compiled with -g), and ran it through jdb. It stepped over the methods from the class with no debug info...same way as before.
    This is annoying. Sun should really provide debug versions of their libraries.
    So how does JBuilder let you step through library methods? Did they take the Sun source and recompile it? Do they have a magic debugger?

  • Can't load data through smart view (ad hoc analysis)

    Hi,
    There is EPM application where I want to give ability to planners to load data through smart view (ad hoc analysis). In Shared Services there are four options in
    EssbaseCluster-1: Administrator, Create/Delete Application, Server Access, Provisioning Manager. Only Administrator can submit data in smart view (ad-hoc analysis). But I don't want to grant Essbase administrator to planners, I'm just interested to give them ability to load data through ad-hoc analysis. Please suggest!

    I take that you refreshed the Planning security, If not refresh the security of those users. Managing Security Filters
    Check in EAS whether those filters are created with "Write" permissions.
    Regards
    Celvin
    http://www.orahyplabs.com

  • Applescript no longer steps through iCal events in sequence

    Hi all,
    I have been using an Applescript that someone on this forum helped me write a few years ago to put unique combos of events into iCal and it has worked perfectly for me, although this year it has begun to jump around within iCal when it is adding events. In other words it used to step through the calendar and add events day by day, progressing chronologically. Now it still accomplishes the task but starts (currently) with May 1 of 2011 and moves to May 16th ... The fact that it still works is cool, but it has slowed the applescript down quite a lot.
    Here is a section of the script...thanks, dan
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into a HTML editor">
    repeat with theEvent in (events of calendar "School Calendar 10-11")
    if isitacycleday contains (summary of theEvent) then
    --Gets the current day and the cycle day number
    set cycleday to summary of theEvent
    set cycleDate to (start date of theEvent) + 1 * hours
    set cycleNumber to last character of cycleday as integer
    --There are always 7 periods in every day
    repeat with periodNumber from 1 to 6
    --Gets the subject from periodCycle
    set theSummary2 to item periodNumber of item cycleNumber of periodcycle2
    set theSummary to item periodNumber of item cycleNumber of periodCycle
    --Checks to see if there's a subject for this period, if not skips to next one
    if theSummary2 is not "" then
    set theStart to date (startTime of item periodNumber of periodTimes) of cycleDate
    set theEnd to date (endTime of item periodNumber of periodTimes) of cycleDate
    --Makes the event in the calender whose name is defined at the top of the script
    make new event at end of calendar TargetCalendar with properties {summary:theSummary, start date:theStart, end date:theEnd}
    end if
    end repeat
    end if
    end repeat </pre>

    Hi Bernard,
    right, I believe you were the one that came up with this script! It still does the trick, although it does begin adding new events at different times depending on when the cache was last deleted (i think). I've used the Onyx program to do this and indeed it influences the start date for the creation of new events via your script, so I don't think it has anything to do with the master calendar. Since I repeatedly run this script to make new events and then export the calendar, delete it, make a new untitled calendar and then run the script again... I've found that iCal and the applescript sloooow down over time and it is best to quit both, maybe even restart and then start the process again. Guess I might never figure this one out.
    Thanks for the help,
    dan

  • Is there a restriction on deleting data from an table through a view?

    I have an Oracle Forms application where, try as I might, I cannot delete records based on a view. I know that the restriction may be because of Forms but, is there a database level restriction on deleting records through a view?

    try as I might, I cannot delete records based on a view. Do you get an error?
    There are several restrictions about deleting via a view:
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#sthref1191

  • Third party system call function module/BAPI through RFC to update Z table

    Dear Friends,
    We have a third party system which directly inserts a Z table in SAP through its programming, which is an auditing issue.
    We want the third party system should call function module/BAPI through RFC so that the Z table gets updated.
    waiting for inputs..
    Thanks,
    Kumar

    if third party system is capable of making Remote Function call, then writing a Function module & making it remote enable is not difficult task in ABAP.
    You may have to prepare specifications first to decide if third party system is going to Read, insert, update, delete records from Zee table.

  • Code works fine when stepping through debug, but not without debug

    I have the following code that works fine when I step through with the debugger, but when I run it with out the debugger it never gets the objects in the "moveObjects" method. I would appreciate any help. Thank you
    import com.crystaldecisions.sdk.exception.SDKException;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.plugin.desktop.program.IProgramBase;
    import com.crystaldecisions.sdk.plugin.desktop.common.*;
    import com.crystaldecisions.sdk.framework.*; //cesession
    import com.crystaldecisions.sdk.plugin.desktop.program.*; //ceplugins
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.infostore.*;
    import com.crystaldecisions.sdk.properties.IProperties;
    import com.crystaldecisions.sdk.plugin.destination.managed.*;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.util.*;
    import java.sql.ResultSet;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    * @author ag0310m
    public class MoveRptInstance implements IProgramBase {
        public void run(IEnterpriseSession enterpriseSession, IInfoStore iStore, java.lang.String[] args) {
            try {
                IInfoObjects objects = null;
                IInfoObjects objs = null;
                IProperties props = null;
                try {
                    getObjectsToSend(objects, iStore);
                    moveObjects(iStore);
                } catch (SDKException e) {
                    //ExamplesUtil.WriteError(request, response, e, "RETRIEVE_ERROR", errorpagerfile);
                    System.out.println(e.toString());
                    //out.clear();
                    return;
            } catch (Exception ex) {
                ex.printStackTrace();
        private void getObjectsToSend(IInfoObjects objects, IInfoStore iStore) throws SDKException {
                        objects = null;
                        objects = iStore.query("Select * from CI_INFOOBJECTS where si_name = 'ReportBurstingTest' and si_instance = 1 and si_recurring = 0");
                        try {
                              sendObjects(objects, iStore);
                         } catch (Exception e) {
                             System.out.println(e.getLocalizedMessage().toString());
                             e.printStackTrace();
                         } finally {
        private void moveObjects(IInfoStore iStore) throws SDKException {
                        IInfoObjects iObjects = null;
                        iObjects = iStore.query("Select * from CI_INFOOBJECTS where si_parentid = 716");
                            int x = iObjects.size();
                            System.out.println("value of x = "+x);
                            for (int ii = 0; ii < x; ii++) {
                                IInfoObject obj = (IInfoObject) iObjects.get(ii);
                                obj.setParentID(868003);
                           iStore.commit(iObjects);                   
        private void sendObjects(IInfoObjects oInfoObjects, IInfoStore infoStore) throws SDKException {
         //Grab the first object in the collection, this will be sent.
            int x = oInfoObjects.size();
            System.out.println("3");
            for (int i = 0; i < x; i++) {
                IInfoObject infoObject = (IInfoObject)oInfoObjects.get(i);
                ISendable obj = (ISendable)infoObject;
                IDestinationPlugin destinationPlugin = getDestinationPlugin(infoStore, infoObject.getKind(), infoObject.getTitle(), infoObject.getUpdateTimeStamp());
                IDestination destination = obj.getSendToDestination();     
                destination.setFromPlugin(destinationPlugin);
        //Send the InfoObjects.
        infoStore.sendTo(oInfoObjects);
        private IDestinationPlugin getDestinationPlugin(IInfoStore infoStore, String kind, String title, Date dte) throws SDKException {
         //Retrieve the Managed Destination plugin from the InfoStore
        //this should be cast as an IDestinationPlugin *DON'T FORGET THE get(0) AT THE END**
        IDestinationPlugin destinationPlugin = null;
        destinationPlugin = (IDestinationPlugin)infoStore.query("SELECT TOP 1 * " +                                                                               
    "FROM CI_SYSTEMOBJECTS " +
                                                                                    "WHERE SI_NAME='CrystalEnterprise.Managed'").get(0);
        //Retrieve the Scheduling Options.
        //This interface is the one which allows us to add the file location for the scheduling.
        IManagedOptions managedOptions = (IManagedOptions) destinationPlugin.getScheduleOptions();
        managedOptions.setDestinationOption(IManagedOptions.CeDestinationOption.ceInbox);
        managedOptions.setIncludeInstance(true);
        managedOptions.setTargetObjectName(title+" - "+dte.toString());
        managedOptions.setSendOption(IManagedOptions.CeManagedSendOption.ceCopy);
        //Set of users that will receive the instance. 
        Set userSet = managedOptions.getDestinations();
        //Query for the id of a particular user that will receive the instance.
        IInfoObjects users = null;
            users = infoStore.query("SELECT TOP 1 SI_ID " +
                                 "FROM CI_SYSTEMOBJECTS " +
                                 "WHERE SI_NAME='Administrator' AND SI_PROGID='CrystalEnterprise.User'");
            if (users.size() > 0) {
             IInfoObject user = (IInfoObject)users.get(0);     
             int id = user.getID();
             userSet.add(new Integer(id));
         return destinationPlugin;

    I'm assuming SI_ID=716 is the Inbox where you're sending the objects.
    The issue is that you're not clicking the "Step Over" button fast enough when debugging.  If you click really fast, then you'll get the same issue.
    Workaround for the non-debug case is to count the number of objects you're sending, then when moving, loop till the InfoStore query retrieves the correct number of objects.
    You're not giving enough time for the Destination Job Server to send the objects to the Inbox - they're not there yet.
    Sincerely,
    Ted Ueda
    Edit:  I see you've identified the issue as well - note that the CMS job scheduling thread triggering interval isn't under programmatic control, so I'd still recommend loop-count-wait workflow.
    Edited by: Ted Ueda on Oct 22, 2009 11:59 AM

  • Step Through a List of .p12 Certificates and Their Passwords to Extract Property Data

    This is a follow-up question to my previous thread:
    http://social.technet.microsoft.com/Forums/en-US/58ca3098-e06d-419a-9465-1ae7973e1c04/extract-p12-property-information-via-powershell?forum=ITCG
    I understand how to extract the information for a certificate one-by-one, but I am wanting to write a powershell script that will step through a list of certificates and a list of their corresponding network passwords in order to extract their property
    data (i.e. expiration date, etc). Any suggestions?
    jrv helped me with the first part of my question by providing this script:
    PS C:\> $filename='c:\temp2\certs\jpd.cer'
    PS C:\> $cert=[System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromSignedFile($filename)
    PS C:\scripts> $cert|fl
    Happy Hunting!

    HINT:
    dir *.cer | %{ [System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromSignedFile($_)}
    ¯\_(ツ)_/¯

Maybe you are looking for

  • Install win 8.1 error looking for disk

    I have a new Mac Mini w/ Mavericks OS.  I have been trying to install Win 8.1 for days.  I had a keyboard on order, finally came today to allow me to Recover the Mac from a failed Win 8.1 install.  I have read hundreds of conversations on this topic.

  • Publishing multiple calendars in iCal

    Is there a way to publish multiple calendars in one view. It seems that I can only view one calendar at a time. I want to be able to overlay all of my calendars so we all know who's doing what when. I''m a Mom with two girls with lots of sports activ

  • Hrms  Report

    Hi All, I have a requirement which needs to show the employee joining count in a daywise.we need to display the data in 365 days the format should be like this.      Turn Over Report on "Year"                                                          

  • Adobe air printing without asking print dialogue box

    hii is it possible create an air application for  printing a text file on the fly without asking print dialogue box... if so please suggest a way to do.. thankss saritha

  • How to disable individual field of a search view

    Hi All, Is there a way to disable individual search field of an advance search view ? The reason for this is that for a particular search field I am defaulting the value and do not want the user to be able to change this default value, in effect filt