Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to return a value from apex.server.process

Veerendra PatilAug 27 2020 — edited Aug 27 2020

Hi,

I am using APEX 19.1

We are using a 3rd party JS plugin in the application.

This JS has a defined function to evaluate a value like

a.b.c = function(arg){

     var a = arg * 10;

     return a;

}

Now, I want to calculate the value from DB - So, I modified the function as

a.b.c = function (arg) {

     var a = getValueFromDB(arg);

     console.log('Value - a --- ' + a);

     return a;

}

function getValueFromDB(p){

     apex.server.process("GET_VALUE", {

        x01: p

    }, {

        //pageItems: ''

        dataType: 'text'

    }).done(function(pData) {

        console.log("value -- " + pData);

        return pData; /// IS this a correct syntax??

    });

}

My console.log is

value - a ---  undefined

value -- 20 /// Correctly fetched from DB

So my main function always return undefined

How do I wait for my apex.server.process to finish and return the value from it before I return the value from my main function?

Please suggest.

Thanks,

Veerendra.

Comments
Post Details
Added on Aug 27 2020
3 comments
2,549 views