Custom Trigger Issues

I am trying to create a PM messaging system with ADDT. So far, things are going pretty well. But I have a problem with a custom trigger i am trying to write. Before a message is sent, I want the recipients private message count to be checked. If it equals 2, an error message is displayed and the message does not get sent. This is the code that I have at the moment.
//start checkPM_Count trigger
function checkPM_Count(&$tNG) {
$username_pmcount = $_POST['msg_reciever'];
$checkPMCount_SQL = "SELECT u_pmcount from members WHERE u_name='$username_pmcount'";
$result1 = mysql_query($checkPMCount_SQL) or die($checkPMCount_SQL."
".mysql_error());
$pm_count = $result1['u_pmcount'];
if ($pm_count == '2') {
$tNG->setError(new tNG_error('The user you are trying to send a message to has 2 private messages, sorry but we cant send your message until that user deletes some of their messages.', array(), array()));
Can anyone tell me if there is something wrong with the code above. No error message is shown and the message is still being sent regardless.
Thanks

I am trying to create a PM messaging system with ADDT. So far, things are going pretty well. But I have a problem with a custom trigger i am trying to write. Before a message is sent, I want the recipients private message count to be checked. If it equals 2, an error message is displayed and the message does not get sent. This is the code that I have at the moment.
//start checkPM_Count trigger
function checkPM_Count(&$tNG) {
$username_pmcount = $_POST['msg_reciever'];
$checkPMCount_SQL = "SELECT u_pmcount from members WHERE u_name='$username_pmcount'";
$result1 = mysql_query($checkPMCount_SQL) or die($checkPMCount_SQL."
".mysql_error());
$pm_count = $result1['u_pmcount'];
if ($pm_count == '2') {
$tNG->setError(new tNG_error('The user you are trying to send a message to has 2 private messages, sorry but we cant send your message until that user deletes some of their messages.', array(), array()));
Can anyone tell me if there is something wrong with the code above. No error message is shown and the message is still being sent regardless.
Thanks

Similar Messages

  • Custom Trigger issues on PO_DISTRIBUTIONS_ALL table... null id?

    Hi...I have a custom after insert trigger on the PO_DISTRIBUTIONS_ALL table
    It is having an issue with getting the req_distribution_id
    I took out all the code and left in just a test, which only inserts the id into a test table. But it is always null! Can someone tell me why? Because there is an ID when created, and I see it after I query the table when it is finished. But I figured, after insert it will be there!
    Below is the trigger...
    create or replace
    TRIGGER APPS.xxmc_po_distributions_auir
    AFTER INSERT OR UPDATE ON PO_DISTRIBUTIONS_ALL
    REFERENCING NEW AS new OLD AS old
    FOR EACH ROW
    DECLARE
    v_trigger_location VARCHAR2(2000):= 'Declaration';
    v_error_message VARCHAR2(2000);
    BEGIN
    delete from test_table;
    insert into test_table values(to_char(:new.req_distribution_id));
    END;
    This enters null every time into the table. Why is that?
    -J

    OK my new trigger has the dml statements in a procedure and it still fails. The ID is always null. Below is the trigger...why is the id coming up null???
    :new.req_distribution_id should never be a null value in my opinion, right?
    create or replace
    TRIGGER APPS.xxmc_po_distributions_auir
    AFTER INSERT OR UPDATE ON PO_DISTRIBUTIONS_ALL
    REFERENCING NEW AS new OLD AS old
    FOR EACH ROW
    DECLARE
    v_trigger_location VARCHAR2(2000):= 'Declaration';
    v_error_message VARCHAR2(2000);
    /* Error Tracking local variables */
    v_user_id NUMBER := FND_GLOBAL.User_Id;
    v_inv_record_id_s NUMBER := 0;
    v_mycall_status VARCHAR2(20);
    v_myerror_msg VARCHAR2(200);
    v_ric_code VARCHAR2(10);
    v_tracking_id VARCHAR2(200);
    v_source_system xxmc_track_summary.source_system%TYPE := 'XXMC_CRM';
    v_destination_system xxmc_track_summary.destination_system%TYPE := 'XXMC_CRM';
    v_rice_name xxmc_track_summary.rice_object_name%TYPE := 'E120';
    v_failure_record_count xxmc_err_track_det.error_count%TYPE := 0;
    v_module_name xxmc_err_track_det.procedure_name%TYPE := 'XXMC_PO_DISTRIBUTIONS_AUIR';
    v_stg_tablename xxmc_track_summary.staging_table_name%TYPE := '';
    v_processed INTEGER := 0;
    v_failed INTEGER := 0;
    v_total INTEGER := 0;
    v_commit INTEGER := 0;
    e_error_tracking_exception EXCEPTION;
    CURSOR c_get_req_line_info(p_req_distribution_id IN NUMBER) IS
    SELECT PORH.SEGMENT1
    , porh.attribute1 po_heading_att1
    , porl.line_num
    , porl.destination_context
    , porl.attribute1
    , porl.attribute3
    , porl.attribute4
    , porl.attribute5
    , porl.attribute6
    , porl.attribute7
    , porl.attribute8
    , porl.attribute9
    , porl.attribute10
    , porl.attribute11
    , porl.attribute12
    , porl.requisition_line_ID
    , to_char(porl.creation_date, 'mm/dd/yyyy hh24:mi:ss') format_create_date_line
    FROM PO_REQ_DISTRIBUTIONS_ALL PORD
    , PO_REQUISITION_LINES_ALL PORL
    , PO_REQUISITION_HEADERS_ALL PORH
    WHERE PORD.DISTRIBUTION_ID = p_REQ_DISTRIBUTION_ID
    AND PORL.REQUISITION_LINE_ID = PORD.REQUISITION_LINE_ID
    AND PORH.REQUISITION_HEADER_ID = PORL.REQUISITION_HEADER_ID
    i number := 0;
    TEMP NUMBER;
    BEGIN
    v_trigger_location := 'Beginning of trigger body';
    KMG_WRITE('INSERTING IN XXMC TRIGGER ON PO DISTRIBUTIONS AT '
    || TO_CHAR(SYSDATE, 'MM/DD/YYYY HH24:MI:SS')
    || ' REQ_DISTRIBUTION_ID = '
    || NVL(TO_CHAR(:new.req_distribution_id), 'VALUE IS NULL') );
    xxmc_tracking_pkg.create_source_tracking_record(
    p_tracking_id => v_tracking_id
    ,p_source_system => 'XXMC_CRM'
    ,p_destination_system => 'XXMC_CRM'
    ,p_rice_object_name => v_rice_name
    ,p_creation_date => sysdate
    ,p_created_by => v_user_id
    ,p_transaction_type => 'XXMC_CRM'
    ,p_status => 'INFLIGHT'
    ,p_if_direction => 'O'
    ,p_sub_status => 'XXMC_PROCESSING_IN_EBS'
    ,p_src_total_records => 0
    ,p_call_status => v_mycall_status
    ,p_error_msg => v_myerror_msg);
    IF v_mycall_status <> 'S' THEN
    RAISE e_error_tracking_exception;
    END IF;
    TEMP:='AAA';
    i := 0;
    FOR r IN c_get_req_line_info(:new.req_distribution_id) LOOP
    i := i + 1;
    UPDATE po_lines_all pol
    SET attribute_category = r.destination_context
    , Attribute1 = r.attribute1
    , Attribute3 = r.attribute3
    , Attribute4 = r.attribute4
    , Attribute5 = r.attribute5
    , Attribute6 = r.attribute6
    , Attribute7 = r.attribute7
    , Attribute8 = r.attribute8
    , Attribute9 = r.attribute9
    , Attribute10 = r.attribute10
    , Attribute11 = r.attribute11
    , Attribute12 = r.attribute12
    WHERE pol.po_line_id = :new.po_line_id;
    UPDATE po_headers_all poh
    SET attribute1 = r.po_heading_att1
    WHERE poh.po_header_id = :new.po_header_id;
    END LOOP;
    EXCEPTION
    WHEN e_error_tracking_exception THEN
    kmg_write('Could not create source tracking record in XXMC PO DISTRIBUTIONS trigger. Status = '
    || v_mycall_status || ' Msg = ' || v_myerror_msg);
    RAISE_APPLICATION_ERROR (
    num=> -20003,
    msg=> 'XXMC PO DISTRIBUTIONS trigger error in '
    || ' create_source_tracking_record '
    || v_myerror_msg);
    WHEN OTHERS THEN
    v_error_message := SQLERRM;
    kmg_write('Error in XXMC PO DISTRIBUTIONS trigger. ' || v_error_message);
    xxmc_tracking_pkg.log_then_report_errors(
    p_tracking_id => v_tracking_id
    ,p_source_system => v_source_system
    ,p_destination_system => v_destination_system
    ,p_det_record_id => v_inv_record_id_s
    ,p_message_name => 'XXMC_PO_DISTRIBUTIONS'
    ,p_message_description => 'XXMC_PO_DISTRIBUTIONS'
    ,p_message_text => ltrim(rtrim(v_error_message))
    ,p_last_update_date => sysdate
    ,p_procedure_name => v_module_name
    ,p_staging_table_name => v_stg_tablename
    ,p_status => 'FAILED'
    ,p_sub_status => 'XXMC_PROCESSING_IN_EBS'
    ,p_src_success_records => v_processed
    ,p_src_failed_records => v_failed
    ,p_dest_success_records => v_processed
    ,p_dest_failed_records => v_failed
    ,p_error_count => v_failed
    ,p_call_status => v_mycall_status
    ,p_error_msg => v_myerror_msg
    ,p_key_field_value => v_tracking_id);
    RAISE_APPLICATION_ERROR (
    num=> -20001,
    msg=> 'Error encountered in XXMC PO DISTRIBUTIONS AUIR Trigger '
    || ' Date = ' || to_char(sysdate, 'mm/dd/yyyy hh24:mi:ss')
    || ' SQLERRM = ' || v_error_message);
    END;

  • Delete mutiple image with custom trigger

    I am attempting to delete multiple images associated with a record being deleted. The record has a field with the default filename, then each image has a prefix ("thumb_", "callout_", "feature_") along with this filename.
    My issue is two-fold. I am attempting this with a custom trigger (on the delete record; using AFTER), but I keep getting an error message when I try to pull in the filename using tNG->getColumnValue(). The error reads:
    tNG_fields.getColumnValue:
    Column file is not part of the current transaction.
    Here is my code:
    $file = $tNG->getColumnValue('file');
    deleteFileAndThumbs($file);
    My second issue is in regards to the redirect after the triggers.
    getPrimaryKeyValue() works just fine. Thus, if I change the image names to correspond to my record's "id" #, it will pull the ID # just fine. It will make it through my code and redirect back to the listing page. However, the images will not be deleted. If I remove the redirect, the images delete, but it just sits on this page. So I assume my issue is a result of the page redirecting before al the images are deleted. Is there a way to not allow the redirect to run until my deleteImages function is completed?
    Thanks!

    Ok. How about executing a SELECT inside a Custom Trigger and accessing
    the resulting rows to use in PHP code also in the trigger?
    Example - within the Custom Trigger execute:
    $sql="SELECT * FROM table";
    How do I execute it? With the regular DW code like:
    mysql_select_db($database_conWV, $conWV);
    $sql="SELECT * FROM table";
    $result = mysql_query($sql, $conWV) or die(mysql_error());
    $row_result = mysql_fetch_assoc($result);
    $totalRows_result = mysql_num_rows($result);
    or with some ADDT code like:
    $result = $tNG->connection->execute($sql);
    If I do the "ADDT" way, how do I access the rows?
    $result['column'] or something?
    Alec
    Adobe Community Expert

  • Custom Trigger on MTL_SYSTEM_ITEMS_B firing twice from Item form

    Hi ,
    I wrote a custom trigger on MTL_SYSTEM_ITEMS_B for after update. When ever an item is update from the seeded Items Form, it is firing twice. When I do it from back end it is working fine. Any insights or fixes into issue will be much appreciated.
    Thanks.

    Obtain FRD log file to find out why the trigger is fired twice.
    R12: Forms Runtime Diagnostics (FRD), Tracing And Logging For Forms In Oracle Applications (Doc ID 438652.1)
    Steps To Take FRD Trace in 11.5.10 & R12 (Doc ID 867943.1)
    R12: How To Create An FRD (Forms Runtime Diagnostic) Log Using Forms 10g (Doc ID 445166.1)
    How To Collect And Use Forms Trace (FRD) in Oracle Applications Release 12 (Doc ID 373548.1)
    Thanks,
    Hussein

  • Session variable not storing in custom trigger

    I have a custom trigger in which I want to store a session variable , so i can use the value in the insert transaction which happens after. But for some reason the session variable is not stored, resulting in the data not being stored.
    any clues would help.
    rudi
    here are the relevant code:
    //start Trigger_Custom_Subject_Mentor trigger
    function Trigger_Custom_Subject_Mentor(&$tNG) {
    //Check subject exists
    @session_start();
    $_SESSION['sb_id'] = $subject_id;
    //end Trigger_Custom_Subject_Mentor trigger
    // Make an insert transaction instance
    $ins_share = new tNG_insert($conn_smart);
    $tNGs->addTransaction($ins_share);
    // Register triggers
    $ins_share->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_share->registerTrigger("END", "Trigger_Redirect", 90);
    // Add columns
    $ins_share->setTable("`share`");
    $ins_share->addColumn("share_item", "NUMERIC_TYPE", "POST", "share_item");
    $ins_share->addColumn("share_subject", "NUMERIC_TYPE", "SESSION", "sb_id");
    $ins_share->setPrimaryKey("share_id", "NUMERIC_TYPE");
    // Register triggers
    $ins_share->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_share->registerTrigger("BEFORE", "Trigger_Custom_Subject_Mentor", 50);
    $ins_share->registerTrigger("END", "Trigger_Default_Redirect", 99, "share.php?item_id={share_item}");

    hi User,
    1) Pull a dummy column in Fx use the Session variable --->(Variable -->session )
    2) Next, goto narrative view in Narrative view section use @1
    3) If u want you can hide the column that we created in criteria section

  • Can anyone help with a custom trigger?

    Hi - I know this is a tough one and appreciate anyone's help!
    I'm trying to create a custom trigger that confirms 2 fields belong to the same record. If they do, proceed with insert transaction.
    I have gone through the tutorial (from the old Interakt Discussion Board tutorial at http://www.interaktonline.com/Documentation/MXKollection/075000_tutorialdiscussionboard.h tm) on how to create a custom trigger that checks to see whether a duplicate message and subject exist in the table and if so, stop the insert. I have this working fine, using my own table and fields.
    Can anyone help me to change the script here to confirm that both fields belong to the same record? Here is what I have right now:
    $query = "SELECT * FROM dan_camptrans_login_familyid_confirmid WHERE family_id = ".KT_escapeForSql($tNG->getColumnValue("family_id"),$tNG->getColumnType("family_id"))." AND confirm_id = ".KT_escapeForSql($tNG->getColumnValue("familyconfirm_id"),$tNG->getColumnType("familycon firm_id"));
    $result = $tNG->connection->Execute($query);
    if(!$result) {
    $error = new tNG_error("Could not access database!",array(),array());
    return $error;
    } else {
    if($numberOfRecords = $result->recordCount()) {
    $uniqueFailed = new tNG_error("There is already a message with the same subject and content!",array(),array());
    return $uniqueFailed;
    } else {
    return NULL;
    Any help would be SUPER appreciated!
    Dan

    Thank you very much Shane for responding.
    Right now, if I fill out the form and enter any numbers in the family_id and familyconfirm_id fields that are currently NOT in the dan_camptrans_login_familyid_confirmid table, the form submits fine. If however, both fields already exist within the same record, the error is returned.
    I guess what I am looking for is the opposite. When the form is submitted, the table dan_camptrans_login_familyid_confirmid is checked. If both field entries are not within the same record, return the error.
    Basically, I am sending out a user ID and confirmation number via mail to users. When they register they need to enter in both of these numbers and only if they match the records will the registration proceed.
    The main recordset/form that this custom trigger is attached to is one for my user registration table. This custom trigger and associated table is only to confirm the user registering has the correct information to register.
    Thanks again - I hope that I am explaining this clearly.
    Dan

  • Use Global Temp Table to overcome Mutating Trigger issue

    Hello all. I need to delete a line in a table, and thought I would get around the mutating trigger issue by creating a GTB table. I created 2 different triggers. One is a Row level trigger, the other a Statement level trigger.
    The first trigger gathers the information I need to identify the line I want to delete. This is:
    CREATE OR REPLACE TRIGGER Requisition_Capture
    AFTER UPDATE OF Delivery_Code on Supply_Items
    FOR EACH ROW
    BEGIN
      IF :NEW.Delivery_Code = '#' THEN
        INSERT INTO Requisition_Storage
          (Req_Code)
        VALUES
          (:NEW.Requisition_Code);
      END IF;
    END;And the second trigger deletes the line:
    CREATE OR REPLACE TRIGGER SUPPLY_ITEM_RESET
    AFTER INSERT ON Requisition_Storage
    DECLARE
    BEGIN
      DELETE FROM Supply_Items r
       WHERE r.Requisition_Code =
             (SELECT t.Req_Code
                FROM Requisition_Storage t, Supply_Items s
               WHERE t.Req_Code = s.Requisition_Code)
         AND r.Order_Qty = 0;
    END;The GTB is as follows stores the information I need to delete the line.:
    -- Create table
    create global temporary table REQUISITION_STORAGE
      req_code VARCHAR2(20)
    on commit delete rows;When the column Delivery_Code is updated in the Supply_Item table, and the value is reset to '#', I want to capture the Requisition_Code in the GTB, so I can run the statement level trigger and delete the reset row. However, I still have a mutating error problem. What am I missing?

    The statement level trigger would need to be an AFTER UPDATE OF Supply_Items for this to work around the mutating trigger issue. You need to ensure that your UPDATE has finished updating all the rows that it is going to update before your statement-level trigger runs.
    As has been pointed out, however, the desire to work around a mutating trigger error almost always indicates that you have a data model problem. And you're almost always better served by fixing the data model than working around the error.
    Justin

  • Can we update oracle standard table Attributes column by custom trigger?

    Can we update the oracle Standard table's Attributes column using custom trigger? Is it allowed by oracle? Is this supported?
    Thanks

    ATTRIBUTE columns store DFF information and therefore custom code can be used to update their contents. Care must be taken that such updates do not cause "logical" corruption (an ATTRIBUTE column may be designed to store the color of a product, for example, but an incorrect SQL statement can update the value to a numeric one, thus causing corruption - Oracle does not have a means to check the validity of these update statements). Also, some localizations, such as Brazil and India, reserve some ATTRIBUTE columns for their use - updating such columns is not supported. More information may be found in the Flexfields Guide for your release at http://www.oracle.com/technology/documentation/applications.html
    HTH
    Srini

  • Custom component issue

    Custom component issue
    According to customer requirements, we want to get such an effect in the development of custom components:
    Drag and drop custom components to the Flex builder work area, it can generate more than the default properties, not just generate "x", "y" attribute.
    【Details are as follows】
    We design a custom panel "CustomPanel.mxml" in the project development, then drag it into the workspace in the Flex builder development environment.
    View the source code found that it can only generate "x", "y" attribute in default. That is:
    <ns2:CustomPanel x="105" y="74">
    </ns2:CustomPanel>
    【Issue】
    How can we do that when drag the 'custom component' into Flex builder workspace,  we can generate "layout" attribute in addition to "x", "y" attributes?
    That is:
    <ns2:CustomPanel x="105" y="74" layout="absolute">
    </ns2:CustomPanel>
    【Note】
    The following code will be generated when the "panel component comes with Flex builder environment" is dragged into workspace.
    <mx:Panel x="121" y="134" width="250" height="200" layout="absolute">
    </mx:Panel>
    How it is done?

    I am sorry to bother you again.
    I have tried the web site content, but it can't helped!
    There is a custom component called 'Basket', source code is as follows:
    package picnic
    import mx.containers.Panel;
    public class Basket extends Panel
      public function Basket()
       super();
       layout = "vertical";
       setStyle("backgroundColor", 0x00FFFF);
       setStyle("horizontalAlign", "center");
    Here it is worked when the attribute "layout" is set to "vertical", but it isn't when "layout" is set to "absolute" !
    When the property is set to "absolute" phenomenon is as follows:
    Drag component such as 'Button' into "picnic component". It will automatically go to the top left corner position,
    just like the 'layout-attribute' is not set.
    Why is there such a phenomenon?

  • How do I contact Verizon corporate regarding customer service issues?

        I'm trying to escalate an issue that I have with customer service and just can't seem to find out how to contact corporate to discuss my issue.  I have talked to customer service supervisers and asked them to escalate my complaint.  After being told it would be 5-7 days to respond, I'm still waiting.  Any help in contacting the right department at corporate would be helpful.

    Hello asianguy1964,
    I am available to assist and address any concerns that you may have in reference to customer service issue! May I ask is your posting regarding a billing issue, wireless service issue, or a interaction with a representative? Also, were you provided a reference number to your complaint? If you have a reference number then I can check on the status of your concern. Prior to investigating your reference number, would you be kind as to share the details of the issue as I'm condifent that we can If I am unable to provide a solution for you then the additional information will help me forward your concern to the appropriate channel. I look forward to hearing from you in the near future.
    Thank you...
    ArnettH_VZW
    Follow us on Twitter @vzwsupport

  • Custom trigger

    Hi--
    I am inserting into 2 tables sc_tblBioInfo and sc_tblSemesterInfo. I have 2 fields 'Plantoenroll' and 'year' that are inserted into 2 different fields into sc_tblSemesterInfo. That works fine.
    I also need to insert 'Plantoenroll' and 'year' combined into 1 field called 'Plantoenroll' in sc_tblBioInfo.
    I have created a custom trigger to combine them and insert into sc_tblBioInfo:
    function Trigger_Custom(&$tNG) {
    $Plantoenroll = $tNG->getColumnValue("Plantoenroll");
    $year = $tNG->getColumnValue("year");
    $newSubject = $Plantoenroll . $year;
    $ins_sc_tblBioInfo->addColumn("Plantoenroll","STRING_TYPE","VALUE",$newSubject);
    return null;
    I am getting an error "Column Plantoenroll is not part of the current transaction." How do I make Column Plantoenroll part of the current transaction?
    Is there a better way to insert 2 fields into a table and also insert those 2 fields as 1 field into a different table?
    Thanks for any help.
    --rayne

    Rayne,
    If I understand correctly, you want to insert/update a different table than the table the ADDT form is inserting to.
    The form on your page inserts a new record into sc_tblSemesterInfo table. You also want to insert a new value based on combining two fields into one and insert or update the new value in the sc_tblBioInfo table.
    Unfortunately, you cannot use:
    $ins_sc_tblBioInfo->addColumn("Plantoenroll","STRING_TYPE","VALUE",$newSubject);
    to update a different database table than the one the form is associated with.
    The correct code would be:
    $tNG->addColumn("Plantoenroll","STRING_TYPE","VALUE",$newSubject);
    but using this in a trigger only allows you to add Columns to the trasaction database table that the form is inserting to. You cannot tell it to update a different database table like this.
    The key question is whether you need to do an Update to an existing record in sc_tblBioInfo, or are you a doing fresh an insert in the sc_tblBioInfo table?
    You need to do a custom trigger that does a database call to do an insert or update operation on the sc_tblBioInfotable table. After you combine the values into a new value, are you needing to insert a new record into the sc_tblBioInfotable table, or are you needing to update an existing record in the sc_tblBioInfotable table?
    Shane

  • Custom Trigger After Insert

    After a insert into table 1, i want to take a value from that transaction and use it in a custom trigger to instert into another datbase the 2 values. One is the primary key value of the transaction of table 1 and the other is a session variable of the logged in user. I can get the value of the session user, but i cant get the value of the transaction field.
    $updateRequestDate = "INSERT INTO request_notify (id_request, username) Values({rsrequest.id_request}, '" . $_SESSION['kt_login_user'] . "')";
    $update_result = $tNG->connection->execute($updateRequestDate);
    if(!$update_result) {
    $updateError = new tNG_error("Error setting the logged in status to N", array(), array());
    return $updateError;
    } else {
    return NULL;
    I have the custom trigger set to go after insert transaction.
    How do you get the value of a transaction field for a custom trigger?

    Gunter,
    You rock. Working example, using your knowledge.
    $updateRequestDate = "INSERT INTO test2 (idtest_note, username_note) VALUES ('". $tNG->getColumnValue("id_test") ."', '". $_SESSION['kt_login_user']."')";
    $update_result = $tNG->connection->execute($updateRequestDate);
    if(!$update_result) {
    $updateError = new tNG_error("Error setting the logged in status to N", array(), array());
    return $updateError;
    } else {
    return NULL;

  • Custom Trigger help needed

    How do I include values from existing recordsets in a SQL statement
    within a Custom Trigger?
    For example, my page has a few recordsets. Assume one of the recordsets
    tells me what state the current user lives in. $row_rsCurUsr['state']
    There is an Insert form on the page with a Custom Trigger (after)
    attached. I need the Custom Trigger to perform another action (insert,
    update, delete, whatever) but it needs to use the $row_rsCurUsr['state']
    value. How can I do this?
    I've tried something similar to:
    $triggerSql = "INSERT INTO anothertable (id, state) VALUES
    ({SESSION.kt_login_id},{rsCurUsr.state})";
    and
    $triggerSql = "INSERT INTO anothertable (id, state) VALUES
    (".$_SESSION['kt_login_id'].",".$row_rsCurUsr['state'].")";
    but neither seems to work.
    Alec
    Adobe Community Expert

    Ok. How about executing a SELECT inside a Custom Trigger and accessing
    the resulting rows to use in PHP code also in the trigger?
    Example - within the Custom Trigger execute:
    $sql="SELECT * FROM table";
    How do I execute it? With the regular DW code like:
    mysql_select_db($database_conWV, $conWV);
    $sql="SELECT * FROM table";
    $result = mysql_query($sql, $conWV) or die(mysql_error());
    $row_result = mysql_fetch_assoc($result);
    $totalRows_result = mysql_num_rows($result);
    or with some ADDT code like:
    $result = $tNG->connection->execute($sql);
    If I do the "ADDT" way, how do I access the rows?
    $result['column'] or something?
    Alec
    Adobe Community Expert

  • Custom Trigger Connection

    Hello All.
    How do I change the connection in a Custom Trigger?
    I want to update a table in a second database.
    Jan

    Jan,
    I'm pretty sure you can do this. You should be able to do something like this in the trigger:
    mysql_select_db($database_Connection_2, $Connection_2);
    $query_RecordsetUpdate = "UPDATE....";
    $RecordsetUpdate = mysql_query($query_RecordsetUpdate, $Connection_2) or die(mysql_error());
    This is just the basic code with no error handling, which you may want to add.
    $database_Connection_2 and $Connection_2 need to match the variable names located in your database connection file for Connection_2 located in the Connections folder of your site.
    I have never had to connect to a separate database, but this should work.
    Be sure to add this at the top:
    require_once('Connections/Connection_2.php');
    So that your php script has access to the information for Connection_2.
    Shane

  • Custom Trigger : how to setError Correctly

    Hello, i try to create a "AFTER" custom trigger for custom validation..
    for example:
    if($tNG->getColumnValue("data")>20){
        - do setError
        - rollback
    any idea how to accomplish this ?

    Hello viktor
    what is your data type? is integer? or your data type is Character and you want check data length?
    you can check data that user entered with form validation easily
    if you want check data length, use 'min char' and 'max char' field in form validation wizard else if your data type is integer, you can use 'Greater than' or 'Less than' fields in validation form wizard
    I hope you can solve your problem
    Regards,
    Hamid

Maybe you are looking for

  • Exchanging data between interface mapping and message mapping possible?

    Hi, please have a look at my interface mapping: source message - > mapping programs 1. Java mapping 2. XSL mapping 3. message mapping > target message in my scenario a Java Class (1) is called for the interface mapping. There, some information ist re

  • .pdf files naturally in landscape won't print to landscape.

    Whether I set landscape as my choice before printing, or I select landscape mode via the printer settings, Adobe will not print the page to resemble the original page.  It shrinks the page to profile size even though the paper is in landscape.  I've

  • How do I get external links to display in DW?

    Where can I find the option for Dreamweaver to load in external picture links (pictures residing at an external URL, not in your local root folders). THanks

  • How to set up POP mail

    I have a pop account I would like to attach to my IPhone. I put in my pop settings as guided on the phone and it is not working. It get an error message saying the certificate could not be verified for that address. I then press continue and it then

  • Looking for eMac: How To Differentiate Between Models Document

    Hello, I have been trying to find an Apple help document about how to differentiate between eMac models. I have found an article about iMacs, but can not seem to find one for eMacs. Here is a link to the iMac article, just so you can better understan