Problem with the Invoke DBAdapter

Posted by KoenB on 20-Jan-2012 07:41

Hi,

When we put the invoke DBAdapter into a for loop and run it 10 times. We don't get the values on time in the loop. We can't work with the first values in the loop.

Is their a way to wait untill the DBAdapter is ready and then execute the code below the statement in the for loop???

Kind Regards,

Koen

All Replies

Posted by sandips on 20-Jan-2012 07:54

Hi Koen,

Your sample application would help us to further look into and provide you the suggestion accordingly.

Thanks,

Sandip

Posted by KoenB on 20-Jan-2012 08:13

When we run the code below we execute the function() x times.
But they are not sorted the right way. Because we think the adaptor does not run synchronously with the rest of the code, is there a way to wait until the adaplet is ready before executing the function?

var i=0;

for (i=1;i

{

    sbm.util.setValue('INPUT1',i);

    sbm.util.setValue('INPUT2',sbm.util.getValue('INPUT_PARAM'));

    sbm.adaplet.invoke(DBADAPTERS\TEST);

    function();

}

Thanks in advance,

Koen

Posted by sandips on 20-Jan-2012 08:22

Hi Koen,


Modify the code snippet sbm.adaplet.invoke(DBADAPTERS\TEST); to sbm.adaplet.invoke(DBADAPTERS\TEST, callBackFunction);

function callBackFunction(){

}

Thanks,

Sandip

Posted by KoenB on 20-Jan-2012 08:41

I tried that already. They gave me the same output. When I refresh my page its like a random generator.

Posted by sandips on 20-Jan-2012 08:46

Hi Koen,

Introducing some delay between each invocation might work.

Thanks,

Sandip

Posted by KoenB on 20-Jan-2012 09:02

Hi,

This is the code now :

var i=0;
var x;
for (i=1;i
{
    sbm.util.setValue('ID',i);
    setTimeout("pass()",500);
    sbm.adaplet.invoke('RMA Lijn Toevoegen/DBAdapters/GET_RMA_LINE','submitValue()');
    setTimeout("pass()",500);   
}
function pass(){x=1}

It works when document.getElementById('DS_ORDERLINES').value is less then 3. Otherwise its randomly.

Posted by KoenB on 20-Jan-2012 13:30

What I can do is make 1 query for the 10... records. Put each column in a list-dataslot.

But how can I get 1 'string' out of the list-dataslot in the script of a web activity???

This thread is closed