Automated Solution for Integrity Constraints?

Here is the situation. I have a parent table with child rows in LIVE. A workspace is then created, and another child is added to one of the parent rows in live. Another workspace is then created, and the parent row for the first workspaces child is deleted. The user tries to merge the second workspace to LIVE, which fails with a ORA-20237 error (expected).
How do I in an automated fashion, determine what row(s) in what workspace(s) are causing the error workspace merge? This is on 10gR2.
Integrity constraint violations do not show up in the CONF views, so that doesn’t help. I need to be able to eliminate the conflicts in an automated fashion, providing notice to the owners of the workspaces that they need to go revise the parts that were forcefully removed. But to do that, I need to know how to locate the issues causing the problem so I can build a package to do this, hands off.
Example script:
SQL> create table test_parent (pk number not null, name varchar2(50),
  2   CONSTRAINT test_parent_ndx PRIMARY KEY (pk));
Table created.
SQL> create table test_child (pk number not null,  fk number, name varchar2(
  2    CONSTRAINT test_child_ndx PRIMARY KEY (pk),
  3    CONSTRAINT test_child_FK01
  4   FOREIGN KEY (fk)
  5   REFERENCES test_parent (pk)
  6   on delete cascade);
Table created.
SQL> exec dbms_wm.enableversioning('test_parent,test_child');
PL/SQL procedure successfully completed.
SQL> insert into test_parent values (1, 'First item');
1 row created.
SQL> insert into test_parent values (2, 'Second item');
1 row created.
SQL> insert into test_child values (101, 1, 'References first item');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test_parent;
        PK NAME
         1 First item
         2 Second item
SQL> select * from test_child;
        PK         FK NAME
       101          1 References first item
SQL> exec DBMS_WM.createworkspace('1', TRUE, 'None',  TRUE );
PL/SQL procedure successfully completed.
SQL> exec DBMS_WM.gotoworkspace('1');
PL/SQL procedure successfully completed.
SQL> insert into test_child values (102, 1, 'References first item');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test_parent;
        PK NAME
         1 First item
         2 Second item
SQL> select * from test_child;
        PK         FK NAME
       101          1 References first item
       102          1 References first item
SQL> exec DBMS_WM.gotoworkspace('LIVE');
PL/SQL procedure successfully completed.
SQL> exec DBMS_WM.createworkspace('2', TRUE, 'None',  TRUE );
PL/SQL procedure successfully completed.
SQL> exec DBMS_WM.gotoworkspace('2');
PL/SQL procedure successfully completed.
SQL> select * from test_parent;
        PK NAME
         1 First item
         2 Second item
SQL> select * from test_child;
        PK         FK NAME
       101          1 References first item
SQL> delete from test_parent where pk = 1;
1 row deleted.
SQL> commit;
Commit complete.
SQL> select * from test_parent;
        PK NAME
         2 Second item
SQL> select * from test_child;
no rows selected
SQL> exec DBMS_WM.gotoworkspace('LIVE');
PL/SQL procedure successfully completed.
SQL> exec DBMS_WM.mergeworkspace('2', FALSE, FALSE, FALSE  );
BEGIN DBMS_WM.mergeworkspace('2', FALSE, FALSE, FALSE  ); END;
ERROR at line 1:
ORA-20237: integrity constraint (CVC.TEST_CHILD_FK01) violated in workspace
LIVE or one of its descendants - child record found
ORA-06512: at "WMSYS.LT", line 6009
ORA-06512: at line 1Bryan

Hi Amit,
The merge operation does result in the deletion of the row from both LIVE and the child workspace. However, this would cause the child table in the other (non-merged) workspace to have data without a corresponding parent row. We can not allow this, and so raise a referential integrity constraint violation. It is also not a conflict, as conflicts are always for rows with the same primary key, not for business conflicts or constraint violations. In the example, the inserted row in the child workspace was for a primary key that was unique within all workspaces, and so no conflict violation would be raised.
The reason it works for a non-CR workspace, is that the parent table row is still visible from the other workspace as it was not automatically deleted.
You can use the DIFF view(with SetDiffVersions) or the MW view(with SetMultiWorkspaces) to determine which rows were deleted from the parent table that you are merging. This information can then be used to find the other workspace/savepoint that is causing the violation and fix it. This could be done by removing the child row or inserting/updating the parent row prior to the other workspace being merged.
Ben

Similar Messages

  • Need a solution for integration BPM and UCM 11.1.1.4?

    Hi all,
    Currently, I am using BPM & SOA 11.1.1.4.
    Could somebody advise me a solution for integration BPM and UCM ?
    I heard somebody said that need to wait to BPM 11G patch set 5 (11.1.1.6) version, which have basic BPM and UCM integration and haven't to using external API like RIDC or CIS.
    Thanks & Regards.
    Ming Nguyen.

    Do not use prebuilt binaries, but compile the package from source with the current libudev.
    sha256sums=(SKIP)
    source=("$pkgname::git+https://github.com/rogerwang/node-webkit.git#tag=nw-v$pkgver")
    to build it in the PKGBUILD, use nw-gyp i guess.
    Last edited by progandy (2013-06-21 22:54:36)

  • How to create business rule for 'Integrity constraint - child not found'

    Hello, I am using JDeveloper 11.1.2.3.0.
    When an integrity constraint is violated an error message coming from database is displayed in my application. In this case is the error "integrity constraint (TableName) violated - child record found "
    How can I personalize the error shown in this case? I tried with EO business rules but I couldn't find this key, only "Key exists" or "UniqueKey".
    Can anyone help?

    Check Catch Me If You Can article. This should be handled there as one of the errors thrown in the model layer. Check the AdfmErrorHandlerImpl ...
    Timo

  • Error Message for Integrity Constraint

    Hi,
    I have a table with called TMREF_MEDIATION_DATA_TREATMENT and one called TMREF_UOC_CRITERIA_MAPPING. There is a foreign key constraint and the TMREF_UOC_CRITERIA_MAPPING
    table has the UID column from the other table in it. When I select delete form TMREF_MEDIATION_DATA_TREATMENT I get an error as expected:
    ORA-02292: integrity constraint (MRS_DEV.TMREF_UOC_CRIT_TO_TREAT_FK2) violated - child record found
    Error
    Unable to process row of table TMREF_MEDIATION_DATA_TREATMENT.
    OK
    But is there any way that I can make this error more user friendly? I do not want it to delete if there is a child record - it must just warn the user.
    Thanks.

    You could use this method:
    http://apex.oracle.com/pls/otn/f?p=31517:185
    which is in the page process. However, you could also create a validation, which will fire before the process is run and check the same.
    Entering an invalid number will violate the constraint (the column is a number column) and this will then call the exception INVALID_NUMBER. You may also declare the constraint exception using
    child_record_not_found EXCEPTION;
    PRAGMA EXCEPTION_INIT (child_record_not_found, -02292);
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Automated Solution for Exporting SQL used in Crystal Reports

    My company has created over 400 reports that are running on Crystal Reports XI. Due to proposed changes in our database, we occasionally need to review the SQL statements of all 400+ reports to determine if any of them would be impacted by the proposed changes. In order to review the SQL used in these 400+ reports, we have had to open each report manually. We would like to know how we can review the SQL used in the reports without having to manually look at each report. I suspect there is a way to either write a program or use a tool that will export the SQL that is used in all reports. In a similar vain, we would be interested in knowing if there is an automated way to identify table names and fields that are used in each SQL statement.

    I see two directions to go:
    1. Review functionalities of .rpt Inspector
    [http://www.softwareforces.com/Product/ri/pro/3/rptInspector.htm]
    - it allows rpt mass analyses
    2. Post your question to ".Net Development - Crystal Reports" forum to see if it is possible to access required information through custom application

  • Differences between trigger and Integrity Constraints

    waht are the differences between trigger and Integrity Constraints

    waht are the differences between trigger and Integrity ConstraintsConstraints are to be preferred:
    "Declarative Ease
    Define integrity constraints using SQL statements. When you define or alter a table, no additional programming is required. The SQL statements are easy to write and eliminate programming errors. Oracle controls their functionality. For these reasons, declarative integrity constraints are preferable to application code and database triggers. The declarative approach is also better than using stored procedures, because the stored procedure solution to data integrity controls data access, but integrity constraints do not eliminate the flexibility of ad hoc data access.
    Centralized Rules
    Integrity constraints are defined for tables (not an application) and are stored in the data dictionary. Any data entered by any application must adhere to the same integrity constraints associated with the table. By moving business rules from application code to centralized integrity constraints, the tables of a database are guaranteed to contain valid data, no matter which database application manipulates the information. Stored procedures cannot provide the same advantage of centralized rules stored with a table. Database triggers can provide this benefit, but the complexity of implementation is far greater than the declarative approach used for integrity constraints."
    More:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/data_int.htm#sthref2976

  • Make your own Fax Server with Automator! (Pagesender solution for Mavericks)

    I have been scouring these discussion boards for some time now looking for a suitable substitute to PageSender, an awesome fax solution for the Mac from SmileOnMyMac LLC, which for some inexplicable reason stopped development and updates after OS 10.6.8. The result is that many small business office users who still rely on fax (and yes...no matter what they tell you, most of the business world DOES still use fax because it's legally binding and more secure than email for the transmission of legal documents or healthcare records, and does not rely on database integration accross different systems, which is sadly but very realistically still a long ways off), and no longer have a way to integrate faxes into a paperless or digital workflow office system.
    I suspect like many folks who receive faxes, those who used PageSender, used a very powerful feature to forward faxes by email, thereby turning your Mac into a Fax server that could distribute your faxes to other workstations and staff throughout the business via email. Presumably, if you have your own email server (Exchange, Kerio, AppleMail server, PostFix enabler etc.) you could distribute faxes on your own internal network, securely behind a firewall, and effectively create a digitial/paperless workflow for your faxes.
    Even if you have a USB modem or multifunction printer that allows you to recieve a Fax to your desktop (Apple's internal fax via printer preferences, and some HP models like the HP MFP 127fw) for example will allow you to recieve a Fax to a desktop folder or forward to a single email address. But the former is of limited functionaliy and the later only lets you send to an email address out over the internet with a registered public domain, which means you give up all control of privacy and means you can't process it through a private mail server to create a digital workflow for your office...
    ...Until now!!!
    I am happy to report that I have finally discovered a very easy and useable feature that will save a lot of time, money, and headaches for those looking to create a digital workflow and fax server system for a small office system. (I don't think there is any limit to scale here, but I suspect offices with more than 10 employees probably have a BizHub, or HP MFP/digital sender that can create the same process directly from the printer, but of course these come with a price tag of $2000 and up...).
    To accomplish this however, you will need some basic requirements which are as follows:
    1) A USB modem from either US Robotics or Zoom Modem. These are readily available from Amazon, MacMall or any number of other online vendors and work very well and seemlessly with all Macs running OSX right up through Mavericks
    OR
    A Multifunction printer that is capable of receiving faxes to a desktop Mac like the HP 127 fw. Other models exist from other manufacturers as well, but you will have to do a bit of research and probably check with the vendor or user manual directly to confirm that Fax to desktop is supported for Mac and OS 10.9.
    2) A dedicated Mail Server (MSFT Exchange, Kerio, MacOSX server with mail server enabled, or PostFix enalber or MailServe from Cutedge Systems)
    You will need to set up an email account on your server that is the parent for all incoming faxes from which the faxes will be sent out as part of your digital workflow. This is beyond the scope of this discussion but if you've come this far and you're still reading, you probably know  how to do this already. I recommend setting this up as a POP account, not IMAP. This way, the attatchments (your faxes) will always remain on your server as a back up, until you delete them from the server.
    3) Now simply go to System preferences and select "Printers and Scanners". Select either the Fax printer for your multifunction printer, or add a fax printer/reviever using the + button and select "Fax" if you are using a USB modem. You must have the USB modem attatched to the computer in order to use the built-in Apple Fax feature for the latter option.
    4) Now click on the receive options. Select "Recieve faxes to this computer" and set your ring answer settings. Check "Save to" and select the designated folder (either Faxes or Shared Faxes on your computer) or create a new folder. Depending on the volume of faxes, and your back up systems, you may want to designate a separate folder on a separate drive, exclusively for your Faxes. This is where all your faxes will be stored.
    5) Now launch "Automator" in your applications folder and create a new workflow. You will be presented with several options. Select "Folder Action".
    6) At the top right of the window space you will see "Folder Action receives files and folders added to" . Select the Fax folder you created in step 4.
    7)On the left hand side of the "Actions" menu select "Mail"
    8) From the list of actions select "New Mail Message" this will take the latest Fax added to your Fax folder and attach it as a PDF to a new outgoing mail. In the "TO" address put the email address that belongs to the parent account your created for the Faxes on your mail server eg. [email protected].  In the subject field you can put "Fax Workflow" or any other generic subject that will identify to all reciptients that this is an email that contains a Fax/PDF attatchment.
    Under "account" use the SMTP account you set up on your mail server to handle the routing of internal emails. In most cases, this will be the same as the parent account created above. (Effectively, this account is sending and receiving emails to itself).
    9) From the list of actions, select "Send outgoing messages".
    10) Save the Automator workflow with a name like "FaxDistribution" or "FaxFlow".
    11) Go back to the Fax folder you created in step 4. Right click or option click on the folder and scroll down the options menu and select "Folder Actions Setup". You will see a list of scripts including the Automator workflow you just created. Choose it.
    That's it!! From now on, when you get a fax, it will get dumped into the designated fax folder, and this will automatically trigger the workflow to atttach and send it as an email to anyone in your office that is set up to receive emails with the "faxserver" address. You now have a paperless fax digital workflow server system for distributing your faxes digitally to anyone in your office who needs to review your faxes. Good luck!

    Thank you for this interesting posting.

  • Database Integrity Constraints

    Hi All
    Is there any DI API component or any other solution to handle the Database Integrity Constraints (Relationships): between parent table and child table.  when I delete a record from parent table referenced by some records on a child table, I want to denied this action
    can I get a solution ?
    best regards
    Med

    Hi Juha
    I develop an Add On, for this case, I must create my ouwn user tables:
    I have a User MasterData Table_1 (MD_Table1),
    and a User MasterData Table_2 (MD_Table_2)which referenced to the first one,
    (MD_Table_2.LinkedTable = "MD_Table_1")
    On these Tables, I have create UDOs
    UDO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
    UDO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
    UDO.TableName="MD_Table_1"
    UDO.Add()
    UDO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
    UDO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
    UDO.TableName="MD_Table_2"
    UDO.Add()
    The problem is:
    When I delete a record (rec_1) from the first Table (MD_Table_1)which is referenced to a record (rec_2) of the second (MD_Table_2), the action is accomplished successfully. in spite of rec_1 is referenced to rec_2 .
    regards

  • Providing DRC solution for ATMs in the enterprise network

    Hi all,
    I am looking for ideas on how to provide a Disaster Recovery solution for thousands of ATMs (Automated Teller Machine) deployed in the bank enterprise network. The solution should consider
    the following facts:-
    1.- Having the ATMs switch the connection to the Server at DRC shouldn't be automatic. This situation might last for the next few years until DRC becomes mirror image of primary data center.
    2.- The ATM servers at the primary and disaster recovery center is single server equipped with high availability (Tandem). I mean to say, there is no SLBs invloved in the connection
    3.- The application running on the ATMs is calling the ATM Server by hardcoded IP address in the application. The bank is willing to visit the ATMs to change once and forever.
    I see source natting as the most appropriate solution, however your opanion and expertise are appreciated.
    Thanks
    Sami

    Sami,
    what kind of solution are you looking for ?
    Is the concern the connection from ATM to central location ?
    Or is it a concern about the server at the central location ?
    For connection issues, I don't see any other solution than providing multiple lines.
    If the concern is the single server, you could have a loadbalancer somewhere in your network.
    The loadbalancer can use probes to check the health of the server.
    If the primary fails, or is unreachable, you can automatically redirect the traffic to the standby.
    ATM machines will point to the virtual ip (you could reuse the current ip and assign a new one to the servers).
    Not sure where to place the loadbalancer without a better idea of the problem to solve and the network.
    Gilles.

  • Error:Unable to reserve .lok file for Integrated WLS server (DefaultServer)

    Hi,
    I am having jdev 11.1.1.1.0.
    Many times I get following error while running my application pages:
    Unable to reserve the .lok file for Integrated WLS server (DefaultServer). Typically this is because another instance of this server is already running in the WLS domain.
    The only way out is to close jdev, delete system11.1.1.1.33.54.07 folder and open jdev again.
    Why is this error dialog shown? Is there any permanent solution?
    TIA

    Thanks for quick reply!
    As suggested in the given thread, I logged into the weblogic console http://127.0.0.1:7101/console/ as 'weblogic' user.
    On the left hand side in the 'View changes and restarts' section, no pending changes are shown. It shows following text:
    Configuration editing is enabled. Future changes will automatically be activated as you modify, add or delete items in this domain.
    Please advise. I can share the application.zip if needed.
    Thanks

  • How to find the table name on which integrity constraint not found

    Hi All
    How to acheive this
    I have a lot of tables with lot of primary key - foreign key
    relationship.
    In plsql
    when any inserts happen in the child table & the corresponding row is not present in the parent table, we get an exception
    ORA-02291: integrity constraint (user1.ppk) violated - parent key not found
    On this exception , in the exception block i want to trap teh name of the parent table on which the primary key for the particular child table was not there
    Is it possible to retrieve the parent table in this way. I am looking for a generic plsql code block which can help to acheive this
    Regards

    scott@ORA92> SET SERVEROUTPUT ON
    scott@ORA92> DECLARE
      2    e_no_parent_key EXCEPTION;
      3    PRAGMA            EXCEPTION_INIT (e_no_parent_key, -2291);
      4    v_fk_cons       VARCHAR2 (61);
      5    v_owner            VARCHAR2 (30);
      6    v_parent_table  VARCHAR2 (61);
      7    v_pk_cons       VARCHAR2 (30);
      8    v_parent_column VARCHAR2 (30);
      9  BEGIN
    10    INSERT INTO emp (empno, deptno) VALUES (99, 60);
    11  EXCEPTION
    12    WHEN e_no_parent_key THEN
    13        -- extract schema.constraint_name from sqlerrm:
    14        v_fk_cons:= SUBSTR (SQLERRM,
    15                      INSTR (SQLERRM, '(') + 1,
    16                      INSTR (SQLERRM, ')') - (INSTR (SQLERRM, '(') + 1));
    17        DBMS_OUTPUT.PUT_LINE ('Foreign key constraint violated: ' || v_fk_cons);
    18        -- extract parent schema.table and parent key:
    19        SELECT owner, table_name, constraint_name
    20        INTO     v_owner, v_parent_table, v_pk_cons
    21        FROM     user_constraints
    22        WHERE     (owner, constraint_name) =
    23            (SELECT r_owner, r_constraint_name
    24             FROM     user_constraints
    25             WHERE     owner || '.' || constraint_name = v_fk_cons);
    26        DBMS_OUTPUT.PUT_LINE ('Parent table: ' || v_owner || '.' || v_parent_table);
    27        DBMS_OUTPUT.PUT_LINE ('Parent key: ' || v_owner || '.' || v_pk_cons);
    28        -- extract parent table columns:
    29        FOR rec IN
    30          (SELECT column_name
    31           FROM   user_cons_columns
    32           WHERE  owner = v_owner
    33           AND    table_name = v_parent_table
    34           AND    constraint_name = v_pk_cons)
    35        LOOP
    36          DBMS_OUTPUT.PUT_LINE
    37            ('Parent table column: ' || rec.column_name);
    38        END LOOP;
    39  END;
    40  /
    Foreign key constraint violated: SCOTT.FK_DEPTNO
    Parent table: SCOTT.DEPT
    Parent key: SCOTT.PK_DEPT
    Parent table column: DEPTNO
    PL/SQL procedure successfully completed.

  • Is there a way to launch an app and a set of actions on startup? (Like an automator-script for ipad)

    Hi all,
    Is there a way to have the ipad execute a series of tasks at startup? (like an automator-script)
    Thank you!

    Hi all,
    For all you who have been looking for a solution for the problem above, here it is :
    http://www.kioskproapp.com/
    The Kiosk Pro app allows you to run any html-scrip locally stored on the ipad!
    Which is great! Because not only does it allow for an infinite amount of possibilities next to the video-looping, it also keeps on working with one click after a reboot!
    The learning curve of usage is quite simple for the problem above, since they provide extensive information on the website and have great customer service.
    I am very very happy I found this app, and I really hope this post saves a lot of people the headaches I've suffered in the course of finding the solution.
    Enjoy!
    Alex

  • What's the best storage solution for a large iLife? RAID? NAS?

    I'm looking for an affordable RAID storage solution for my Time Machine, iTunes Library, iMovie videos, and iPhoto Library. To this point I've been doing a hodgepodge of external hard drives without the saftey of redundancy and I've finaly been bitten with HD failures. So I'm trying to determine what would be the best recommendation for my scenario. Small Home Office for my wife's business (just her), and me with all our media. I currentlty have a mid-2010 Mac Mini (no Thunderbolt), she has an aging 2007 iMac and 2006 MacBook Pro (funny that they're all about the same benchmark speed). We have an AppleTV (original), iPad2 and two iPhone 4S's.
    1st Question: Is it better to get a RAID and connect it to my Airport Extreme Base Station USB port as a shared disk? OR to connect it directly to my Mac Mini and share through Home Sharing? OR Should I go with a NAS RAID?
    2nd Question: Simple is Better. Should I go with a Mac Mini Server and connect drives to it? (convert my Mac Mini into a server) or Should I just get one of those nice all-in-one 4-bay RAID drive solutions that I can expand with?
    Requirements:
    1. Expandable and Upgradeable. I don't want something limited to 2TB drives, but as drives get bigger and cheaper I want to easily throw one in w/o concerns.
    2. Simple integration with Time Machine and my iLife: iTunes, iMovie, iPhoto. If iTune's Home Sharing feature is currently the best way of using my media across multiple devices then why mess with it? I see "DLNA certified" storage on some devices and wonder if that would just add another layer of complexity I don't need. One more piece to make compatible.
    3. Inexpensive. I totally believe in the "You Get What You Pay For" concept. But I also realize sometimes I'm buying marketing, not product. I imagine that to start, I'm going to want a diskless system (because of $$$) to throw all my drives into, and then upgrade bigger drives as my data and funds grow.
    4. Security. I don't know if its practical, but I like the idea of being able to pop two drives out and put them in my safe and then pop them back in once a week for the backup/mirroring. I like this idea because I'm concerned that onsite backup is not always the safest. Unfortunately those cloud based services aren't designed for Terabytes of raw family video, or an entire media library that isn't wholey from the iTunes Store. I can't be the only one facing this challenge. Surely there's an affordable way to keep a safe backup for the average Joe. But what is it?
    5. Not WD. I've had bad experiences with Western Digital drives, and I loathe their consumer packaged backup software that comes preloaded on their external drives. They are what I meant when I say you get what you pay for. Prettily packed garbage.
    6. Relatively Fast. I have put all my media on an external drive before (back when it fit on one drive) and there's noticeable spool-up hang time. Thunderbolt's nice and all, but so new that its not easily available across devices, nor is it cheap. eSata is not really an option. I love Firewire but I'm getting the feeling that Apple has made it the red-headed step-child of connections. USB 3.0 looks decent, but like eSata, Apple doesn't recognize it exists. Where does that leave us? Considering this dilemma I really liked Seagate's GoFlex external drives because it meant I could always buy a new base and still be compatible. But that only works with single drives. And as impressive as Seagate is, we can't expect them to consistently double drive sizes every two years like they have been -cool as that may be.
    So help me out without getting too technical. What's the best setup? Is it Drobo? Thecus? ReadyNAS? Seagate's BlackArmor? Or something else entirely?
    All comments are appreciated. Thanks in advance.

    I am currently using WD 2TB Thunderbolt hard drive for my iTunes, which i love and is works great.  i am connected directly to my Mac Book Pro. I am running low on Memory and thinking of buying a bigger Hard drive.  My question is should I buy 6TB thunderbolt HD or 6TB NAS drive to work solely for iTunes.  I have home sharing enabled for my Apple TV 
    I also have my time capsule connected just as back up only.   

  • Help Needed: Automator Applescript for Folder Action - Encode Video

    Hi !
    I have created an Automator Applescript for a Folder Action to do the following:
    When a new video file is moved to the target folder (i.e. Download of Vuze is done), automatically launch the Applescript Action that does the followin g(Applescripted):
    1) Using "run shell script" and FFMPEG on a UNIX command line, determine Width/Height, Framerate, Bitrate
    2) Calculate encoding parameters (slightly reduced bitrate, reduced Aspect etc.)
    3) Using "run shell script" with ffmpeg on the command line and the calculated parameters to encode the video file
    At the same time, the action is written to a log file so I know if a file is recognized, when encoding started etc.
    It works fine if I save this Action as an .app, make an alias on the Desktop and drop video files on it.
    It also works fine if I attach the script to a folder as a folder action and drag a video file in there.
    However, when I attach the script as a folder action to the Vuze download folder, it encodes only some video files, i.e. if there was a download of 5 files, chances are good that it will not encode 1 or 2 files out of those 5.
    If for example a second download finishes while the encoding for the first download is still going on, sometimes the second file starts encoding after the first encode finishes, sometimes it does not, the file does not make the log file at all, i.e. the folder action missed it or the automator action dropped it because it was still encoding. Still, sometimes it happens, sometimes not.
    As I need a solution that is 100% accurate, I would like to ask if there are any ideas on how to do this better maybe? As I am not an Applescript Guru, I would need some help to know what works and what doesn't and what the syntax is.
    My main idea right now:
    Similar to how ffmpegX works with its "process" application, have a second script (as .app) that receives the files to be encoded from the automator action and puts them in a queue, then proceeds to encode this queue while the main automator action is free to receive the next file.
    Writing this second app is quite straightforward (a modified version of my current script) but I have some questions I need help with:
    1) How do I call another applescript from within an existing applescript that launches the new applescript in a new process?
    2) How do I pass parameters to this new applescript?
    3) In case of this "Queueing" Idea, once I called the external applescript the first time, how do I make sure when I call next time, that I don't open a second instance of this script but rather pass another queue item to the original instance to be processed?
    Or in general: Is there a better way to achieve this automatic encoding solution that I have not thought about?
    Alternatively:
    Does anyone know how to call the "process" application that comes with the ffmpegX package with the correct parameters to use as a queueing / processing tool?
    Thanks!
    Joe
    Message was edited by: Joe15000
    Message was edited by: Joe15000

    To do this, I created an Automator workflow with an Applescript snippet to change the 'media kind'.
    Here is the 'Run Applescript' workflow step code:
    on run {input, parameters}
              tell application "iTunes"
                        set video kind of (item 1 of input) to movie
              end tell
              return input
    end run
    Prior to this running, I have an 'Import Files into iTunes' workflow step.
    You can switch out 'movie' with: 'TV show', 'music video', or anything in ITLibMediaItemMediaKind.
    Good luck,
    Glenn

  • I look for integrated in the legend bloc of diaporama, a widget such as "Accordion" for, with a click, or passing with mouse, open a new legend for each photo. I tried with "Accordion" of Muse, it does not work. I tried copy/paste, mais no result. The wid

    Question.
    I look for integrated in the legend bloc of diaporama, a widget such as "Accordion" for, with a click, or passing with mouse, open a new legend for each photo. I tried with "Accordion" of Muse, it does not work. I tried copy/paste, mais no result. The widget disappear in bloc legend. disparaître. Have you one solution?
    Thank you,
    Loïc

    Accordion or Tabbed panel should to it, with click and open container.
    Please provide site url where this does not work, also if you can provide an example where we can see the exact action then it would help us.
    Thanks,
    Sanjit

Maybe you are looking for

  • Sales Billing Issue

    Hi All, My Scenario I have a sales order time with a price X with multiple schedule lines ( Have to be maintained manually in sales order. No Condition record is maintained for Price due to laborious work pressure) At the time of delivery of each sch

  • Acrobat 9 Distribute Forms Problem

    I'm using Acrobat 9 Standard in Windows 7 Professional. I have created a form with all the necessary fields, but when I click on the Distribute Form button, nothing happens.  I've tried several ways to launch this wizard, but can't seem to get the or

  • Low and bad screen resolution with radeonhd [SOLVED]

    Hi Archers, I just setted up a brand new PC with an ATI HD4550 GPU and a 22'' 1680x1050 monitor. I can run Xorg and even Gnome using the radeonhd drivers, but the max resolution I can get is 1280x1024 (which isn't even the correct ratio). The lower s

  • Serial Number UDF's Not Uploadable Thru DTW

    Hi, Our current warehouse is setup as serial number managed.  We had to create some UDF's in the serial number table to satisfiy some of our requirements. The problem I have is that I am unable to make a customize template for serial numbers via DTW

  • HTLM not loading in multiple browsers

    Hi all, I'm trying to view an animation of a student of mine and it is not loading in Firefox (32), Chrome (37) or IE (11). It plays fine in Animate CC 2004. It's not doing anything too sophisticated - just a series of pngs. The student has claimed i