How to use transformation script to add FK to relational model

Hi,
I've looked through a few of the examples dealing with Foreign Key's, but I can't seem to get the code correct to add a new FK to a table and use the existing columns in the table.
This code will add a Foreign Key from ENVIRONMENT_REQUEST to the ENVIRONMENT table pointing to the columns in the ENVIRONMENT_PK index. The problem is that it also adds a new column in the ENVIRONMENT_REQUEST table to be used for the Foreign Key.
table = model.getTableSet().getByName("ENVIRONMENT_REQUEST");
remoteKey = model.getGlobalIndexSet().getByName("ENVIRONMENT_PK");
fk = table.addFK(model.getGlobalIndexSet().getByName("ENVIRONMENT_PK"));
fk.setName("NEW_FK_TO_ENVIRONMENT");
I have tried creating a localFKIndex but the generated column still exists. Is there an addFK method where I can specify the local columns to be used in the Foreign Key so the additional column is not created?

Guess the trick was to use table.addForeignKey passing as a parameter the referenced key and the list of columns in the local table
table = model.getTableSet().getByName("ENVIRONMENT_REQUEST");
remoteKey = model.getGlobalIndexSet().getByName("ENVIRONMENT_PK");
java.util.List<String> list = new ArrayList<String>();
list.add(table.getElementByName("ENVIRONMENT_ID"));
fk = table.addForeignKey(remoteKey, list);
fk.setName("NEW_FK_TO_ENV");

Similar Messages

  • How to use java script when popups are blocked in browser

    How to use java script when popups are blocked in browser

    Not. When people install a popup blocker they don't WANT popups, so stop trying to force them down their throats.

  • How to use Java Script in jspx pages of ADF Faces?

    I wanna invoke an Applet in a jspx using Java Script...
    How can I do this? :)

    check my other post..that's to know how to use js in jsf pages...not to invoke applet..
    Re: how to Add inline JavaScript to a Page 11G

  • How to do Delta upload and consolidate in SSM, how to use transformer.ini

    Hi,
    Can anybody explain me how to do Delta data upload and also how to do delta data consolidation in SAP SSM.
    Also how can i create and use transformer.ini file.
    Thanks and reagrds
    Edited by: Himanshu Bisla on Mar 25, 2009 2:09 PM

    Hi,
    Where from are you planning to upload data?
    When you mention a delta upload, does it mean loading new data for a new PERIOD, where no data yet existed, or loading values to measures for periods where data already exists, doing a SUM?
    When loading from an external source, you use a READ command, which by default replaces existing values with those that are being loaded. If you add the parameter ADD or SUBTRACT to that IDQL command you are able to change this default behaviour to enable delta loads (with SUM or SUBTRACTION operations).
    As for the CONSOLIDATIONS, you can define a date range for the consolidation, or run it for a single period (month, quarter) if needed, or restrict the number of measures you want to consolidate. There is no way to automatically define that only the measures and periods that have new data will be consolidated. This has to be made explicit in the CONSOLIDATE instruction.
    Regarding the Transformer.ini, are you planning to use PAS as an ETL tool? Unfortunately, I can only point you to the information that is available on the PAS Help, but that's probably where you found the reference to this function in the first place...
    Hope this helps!
    Best regards,
    Ricardo

  • How to use import script with FDM using adapter ERPI?

    Hi,
    I use FDM and ERPI 11.1.2 to load data from EBS R12 to Planning 11.1.2
    Data loaded from eBS are YTD data.
    I have seen that I could use an import script to calculate manually the amount with the periodic_net_cr and periodic_net_dr fields.
    But how to use this import script? Because in my import format in FDM, I don't use a file but directly the adapter, so no "Expression" field.
    Thanks in advance for your help
    Fanny

    Hello Fanny,
    No you will not need to put anything in the BatchAction. If you review the FDM API Documentation posted it will outline all the scripts that will execute for a particular event ... and the order in which they execute. The BatchAciton only affects the execution of the batch ... it does not control processing of data. Processing of data is controlled by many others.
    There is a script that can be written and placed (as Tony mentioned) in the ImportAction that will be able to recaculate the values from ERPi to be YTD values. You can possibly open an SR and a support Engineer can help you .... or you can search the current KM base and use that information there from the v11.1.1.3.00 version to build your own for v11.1.2.x
    Thank you,

  • How to use the calendar to add events and reminders?

    Since updating to the most current software, I am unable to add events or reminders to my iphone calendar.  Does anyone know how to use it now?  I really miss my calendar!
    Thanks in advance

    randers4, you saved my life!!  At least my social calendar life, including all my appointments and important dates.  After the last update, my + sign went away, but turning it on in the iCloud settings did the trick.  Thanks for your help!!

  • How to use Transformer.INI file

    Hi All,
    Please let me know how to create and use Transformer.INI file SSM .
    How to upload data through Transformer.INI file in SSM
    Thanks
    Chavi

    Hi Tino,
    sapmsg.ini is opend by LIBRFC32 - not NCo directly.  You can look into RFC SDK documentation for details (this is install with SAPGUI).
    you can try to resolve the problem by setting the following environment variable:
    RFC_LOGON_INI_PATH=<PATH_TO_SAPGUI_DIRECTORY>
    Regards,
    adlin

  • How to use --version-script option of gnu ld on SunOS

    I use --version-script=gnu-ld-script to build my c++ source on linux successfully.
    The file gnu-ld-script has only one line like this: EXPORTED { global: mozembed_main; local: *; };
    how can i build the source on SunOS/Solaris, given that there is on --version-script option for ld on SunOS.
    help me. thanks.

    i mean there is no option of --version-script for ld command on SunOS.
    then how can i do, if i want this feature.

  • How to use the script placemultipagePDF with reduction?

    In need to use the script placemultipagePDF, but in need this have a reduction 77%

    try below code, i modifide sample cone provide adobe as per ur requirement.
    main();
    function main(){
        //var myCounter = 1;   
        var myDocument = app.documents.item(0);
        var myPage = myDocument.pages;
        var myPDFFile = new File("E:\\Work\\Scripting InDesign CS3-4 with JavaScript April 2009.pdf");
            if((myPDFFile != null)){
                for (var p=0; myPage.length>p; p++){
            myPlacePDF(myDocument, myPage[p], myPDFFile);
    function myPlacePDF(myDocument, myPage, myPDFFile){
        var myPDFPage;
        app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;
        var myCounter = 1;
        var myBreak = false;
        while(myBreak == false){
            if(myCounter > 1){
                myPage = myDocument.pages.add(LocationOptions.after, myPage);
            app.pdfPlacePreferences.pageNumber = myCounter;
            myPDFPage = myPage.place(File(myPDFFile), [0,0])[0];
            myPDFPage.verticalScale =77;
            myPDFPage.horizontalScale = 77;
            if(myCounter == 1){
                var myFirstPage = myPDFPage.pdfAttributes.pageNumber;
            else{
                if(myPDFPage.pdfAttributes.pageNumber == myFirstPage){
                    myPage.remove();
                    myBreak = true;
            myCounter = myCounter + 1;

  • How to use Java Script in Oracle Forms 10g

    Hello,
    Appreciate if anyone could help me using Java Script in Oracle Forms 10g?
    Thanks
    GM

    Thank you for your reply. I was reading on the metalink that we could use the to call the java script from oracle Forms 10g (Doc ID 265863.1)
    Example:
    WEB.SHOW_DOCUMENT ('javascript:void(window.open("http://www.oracle.com","","location=no,toolbar=no,menubar=no,status=no,"));self.close()','_blank');
    I tried it but it did not open the any window as it claims. Am I missing anything? Is there any IE related setting which I need to modify for the above to work?
    Regards
    GM

  • How to use stored script from with Grid Control 10gR2

    HI
    My backup method uses a stored script in the recovery catalog that is separated from Grid Control's repository database.
    In Scheduled Backup, there is no way to connect to recovery catalog; let alone use stored script. Is that true?
    Thanks,
    Kevin

    it works, here is a test case , I use this functionality a lot
    $connected from HOST
    rman target / catalog <mycatalog>
    connected to target database: TOPAZ (DBID=3348250252)
    connected to recovery catalog database
    RMAN> create script testbackup
    2> {backup current controlfile;
    3> }
    created script testbackup
    RMAN> run {execute script testbackup;}
    executing script: testbackup
    Starting backup at 12-JUN-07
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=217 devtype=DISK
    allocated channel: ORA_DISK_2
    channel ORA_DISK_2: sid=251 devtype=DISK
    allocated channel: ORA_DISK_3
    channel ORA_DISK_3: sid=200 devtype=DISK
    allocated channel: ORA_DISK_4
    channel ORA_DISK_4: sid=337 devtype=DISK
    allocated channel: ORA_DISK_5
    channel ORA_DISK_5: sid=182 devtype=DISK
    channel ORA_DISK_1: starting full datafile backupset
    channel ORA_DISK_1: specifying datafile(s) in backupset
    including current controlfile in backupset
    channel ORA_DISK_1: starting piece 1 at 12-JUN-07
    channel ORA_DISK_1: finished piece 1 at 12-JUN-07
    piece handle=/rman_backup/d_TOPAZ_s_12344_p_1_t_625077001 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
    Finished backup at 12-JUN-07
    Starting Control File and SPFILE Autobackup at 12-JUN-07
    piece handle=/rman_backup/c-3348250252-20070612-06 comment=NONE
    Finished Control File and SPFILE Autobackup at 12-JUN-07
    NOW in grid control I have configured my Recovery catalog settings, check for OS username , that should be owner of oracle home for recover catalog
    I schedule a RMAN backup job with these parameters in script
    {execute script testbackup;}
    Status          Running
         Step ID          203585
         Targets          topaz.ucas.ac.uk
         Started          12-Jun-2007 16:34:56 (UTC+01:00)
         Step Elapsed Time          1 minutes, 37 seconds
         Management Service          stardb1:4889_Management_Service
         TIP      Management Service from which the job step was dispatched.
    Output Log
    Recovery Manager: Release 9.2.0.6.0 - 64bit Production
    Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
    RMAN>
    connected to target database: TOPAZ (DBID=3348250252)
    RMAN>
    connected to recovery catalog database
    RMAN>
    echo set on
    RMAN> {execute script testbackup;}
    2> exit;
    executing script: testbackup
    Starting backup at 12-JUN-07
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=164 devtype=DISK
    allocated channel: ORA_DISK_2
    channel ORA_DISK_2: sid=134 devtype=DISK
    allocated channel: ORA_DISK_3
    channel ORA_DISK_3: sid=22 devtype=DISK
    allocated channel: ORA_DISK_4
    channel ORA_DISK_4: sid=198 devtype=DISK
    allocated channel: ORA_DISK_5
    channel ORA_DISK_5: sid=145 devtype=DISK
    channel ORA_DISK_1: starting full datafile backupset
    channel ORA_DISK_1: specifying datafile(s) in backupset
    including current controlfile in backupset
    channel ORA_DISK_1: starting piece 1 at 12-JUN-07
    channel ORA_DISK_1: finished piece 1 at 12-JUN-07
    piece handle=/rman_backup/d_TOPAZ_s_12346_p_1_t_625077300 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
    Finished backup at 12-JUN-07
    Starting Control File and SPFILE Autobackup at 12-JUN-07
    piece handle=/rman_backup/c-3348250252-20070612-07 comment=NONE
    Finished Control File and SPFILE Autobackup at 12-JUN-07
    null

  • How to use java script in  sun stdio crator  jsf

    in sun stdio creator
    Checkbox cb;
    cb=new checkbox();
    ch. markforDeletion.setOnChange("submit()");
    it is giving identifier excepted .
    how to use setOnChange and other functio
    with regards
    shannu sarma

    in sun stdio creator
    Checkbox cb;
    cb=new checkbox();
    ch. markforDeletion.setOnChange("submit()");
    it is giving identifier excepted .
    how to use setOnChange and other functio
    with regards
    shannu sarma

  • How to use a script to kill only forms sessions idle for over 30 minutes?

    We want to use a script to kill forms users idle for over 30 minutes, but we don't want to kill background concurrent processes waiting for resources. even though we set up the timeout but it won't work for users who exit forms ungracefully.
    thanks!

    Java runs at the serverside, while you need a clientside solution. Javascript is perfectly suitable. Pass the current maxInactiveInterval() value to a Javascript variable and write a function around it. You can use for example the onkeypress attribute of the body to clear the timeout counter.

  • Subview formatting using transformation script

    Hi,
    We have 200+ subviews with tables consisting of roughly 100 columns a piece. After the models were created, we decided that we would only show the PK and FK columns and hide the rest. I was able to write a transformation script to only show those columns, but now my tables are showing up as if they have 100 columns, but only show 2. What do i need to do in the transformation script to "Best Fit" the size of each of the tables, and then set auto layout - layout 1 for the diagrams.
    Thanks
    diag = model.getAllDiagrams();
    for(it = diag.iterator(); it.hasNext(); ){
          cur = it.next();
          log(cur.getName());
          cur.setShowAllDetails( false);
          cur.setShowKeys( true);    
          cur.setShowLegend(false);
         //TODO
         //Some loop to "BEST FIT" all components in the diagram
         //TODO
         //run auto layout to arrange the diagram    
         //maybe rearrangeNewDiagram() or setLayout(LayoutManager mgr)?
          cur.setDirty( true);
    def log(String str){
    oracle.dbtools.crest.swingui.ApplicationView.log(str);

    Perfect, that's what I needed. Thanks
    diag = model.getAllDiagrams();
    for(it = diag.iterator(); it.hasNext(); ){
            cur = it.next();
            log(cur.getName());
            cur.getPlaceHolder().setVisible(true); 
            cur.setShowAllDetails( false);
            cur.setShowKeys( true);   
            cur.setShowLegend(false);
            cur.resizeTables(); 
            cur.resizeViews(); 
            cur.rearrangeDiagram2(1, true, 'Layout 1'); 
            cur.setDirty( true);
    def log(String str){
        oracle.dbtools.crest.swingui.ApplicationView.log(str);

  • How to use Find Change to add FC in front of all item numbers?

    Hello,
    I am using Indesign CS5 on iMac, running OS 10.8.3.
    I designed a product catalog that has 148 pages. Now I need to save the same design and make a new catalog for our wholesalers. On the wholesalers catalog I need to change the item numbers and add FC in front of each item number. How can I use find change to find each item and change them with FC in front of the item numbers? The following are a few examples of the item numbers:
    LED-4042 I want to change it to FCLED-4042
    UA-42 I want to change it to FCUA-42
    SC-110 change it to FCSC-110
    KN-10 change it to FCKN-10
    etc....
    I am hoping there is a fast way to find and change these.  I was looking in to GREP, but I could not figure how to do this.
    Thanks,
    Omar

    One way would be to just run it and then *remove* any double FC's -- but GREP can do even more! One of its many functions is to scan ahead for the presence or absence of certain text, and only act when it is (or it is not) there. This is called "lookbehind" (before the text you want to match) and "lookahead" (after the text you want to match).
    In this case, you want to find a phrase starting with capitals, but NOT the exact string "FC". That's a job for Negative Lookahead -- Only Match If Not.
    Try this: search for
    \b(?!FC)\u+-\d+\b
    ... the Replace With stays the same.

Maybe you are looking for

  • PO creation error - FBGENDAT parameter does not exist

    Hi SRM experts I'm trying to verify the error that occurs when the automatic creation of a PO. I know you must enable the parameter FBGENDAT on my R3. However, this parameter does not exist on my R3. What should I do? The R3 version is 4.6 C. This fu

  • Regarding decimal points in QATR

    Hi , I am having an issue regarding the decimal points descrepancy in QATR (Quality Assurance test report). The settings for decimal points for some of the inspection characteristics are not matching with the QATR report. Please help me in sorting ou

  • Tables and lists and maintenance

    I've looked through the CS3 Bible and still can't see any way to handle a very simple problem. I want a table on my web page which will contain 3 columns and multiple rows. I simply want to put a name in each cell. Since the list of name is long I do

  • Exporting a project into an external HD as a file

    I do not use the vault in Aperture mainly because I could never get back into it to retrieve my pictures. (Apple has made this way to difficult) I would like to use an external harddrive and just export my projects monthly into a folder. I have tried

  • Lightroom 5 trial will not download

    The dowload asks for Authentication - I use Abode registration email + Password. It just loops and continues to ask.