cancel
Showing results for 
Search instead for 
Did you mean: 

Update Command Problem

Former Member
0 Kudos

Hello

Well, recently I had to add two new columns to an already created table in my xMII DB (MS Sql Server). After that I had to modify a few of the querys to show the new info available. I'm facing a weird issue with the one used to update the records of said table. This is the query I have in xMII defined as a command. (table and columns name had been change for security issues):

UPDATE 

     Table_Name

SET

     Table_Name.paramA  = '[Param.1]',

     Table_Name.paramB = '[Param.2]',

     Table_Name.paramC = '[Param.3]'

WHERE

     Table_Name.paramID  = '[Param.4]'

When I call this query from the CRUD page, it executes successfully but when I reload the grid data only one of the parameters is updated. This parameter is the one that was originally meant to be updated before the two new columns where introduced. If I hardcode the values in the query, the table values are updated so I know the query is OK. I'm really confused with this behavior and would appreciate any insides you could have on this.

Regards

Ximena

Accepted Solutions (0)

Answers (1)

Answers (1)

jcgood25
Active Contributor
0 Kudos

It would be good to see your javascript that gets the query object and sets the param.x's.

If you know the query template works with the test param.x values, and you can confirm that the same exact query is referenced by the iCommand applet (assumed) then it might be in the script. 

If the DB update is actually happening for the original param, then you're not producing a syntax error in the query, so the NetWeaver logs might not show you anything (but never hurts to check).

Former Member
0 Kudos

Hi Jeremy, this is my Javascript:

function grabar() {

    var applet = document.getElementById('update_command');

    if (document.getElementById('werks').value != "") {

        var mot = document.getElementById('mot').value;

        var pro = document.getElementById('pro').value;

        var tipo_par = document.getElementById('type').value;

        var def_time =document.getElementById('time').value;      

        //  alert(mot+" - "+pro + " - " + tipo_par + " - " + tiempo_par ); //This shows the right values, was here for debug

        applet.getQueryObject().setParam(1, pro);

        applet.getQueryObject().setParam(2, tipo_par);

        applet.getQueryObject().setParam(3, def_time);

        applet.getQueryObject().setParam(4, mot);

        if (applet.executeCommand()) {

            alert('Correct');

            document.iGrid.updateGrid(true);

        } else {

            alert('Error');

        }

    }

}

The HTML iCommand (that is the right query):

  <applet id="update_command" width="1" height="1" code="iCommand" codebase="/XMII/Classes" archive="illum8.zip" >

    <param name="QueryTemplate" value="MOT_CRUD/Query/Qry_new_update">

  </applet>

As for the logs, I don't have them right now.

I really don't see any mistakes anywhere. It's a mistery