cancel
Showing results for 
Search instead for 
Did you mean: 

HWC - Process Online-Request's results from multiple queries

Former Member
0 Kudos

Hi Experts.


I'm new at SAP.

We are using SUP 2.2 SP04.

We created an application that uses online request (MBO objective query) and works on HWC .

We could call query and process incoming data in such a way that at the following URL : SyBooks Online .

But we have a problem when client receives two or more results almost at the same time - The results from query which received in advance vanish.

For example,we receive results from query1(receive results in advance) and query2(receive results later) almost at the same time ,and results from query1 are vanished.

Now we're deal with this problem by generating the waiting time by the synchronization process.

Are there any solutions?

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Can you clarify what you mean by "the results from query1 are vanished"?

Your hwc.processDataMessage() function should be called for each online request.

Thanks,

Andrew.

Former Member
0 Kudos

HI,andrew.

After call two query in rapid succession,

we are confirmed that hwc.processDataMessage() calls twice.

But we couldn't process data incoming first,

because the second processing may start before the first one is finished...


Be synchronized so as not to overlap two processes is the best practice ?


Thanks.



Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Is it possible for you to share what exactly you have written the logic/code? Did you try to put alert message for incoming request?

You can check below link how I have put alert to verify an incoming call request

http://scn.sap.com/community/developer-center/mobility-platform/blog/2013/07/18/hwc-application-deve...

Rgrds,

JK

Former Member
0 Kudos

Hi jitendra,

I apologize to everyone that confirmation before the consultation was insufficient first.

I started this discussion at the request from the project members,

but after a review of the code, it was found that

the problem we are facing is different from what I had heard...sorry.

The problem is that It's not possible for us to distinguish

between the two response after we call the same query of MBO twice.

function test(my_account){

     //create MBO object

     getprofileObj = new GetProfile();


    // set param

     getprofileObj.my_user_account = my_account;


    //call MBO

     registrationmember_findByUserAccount(

                getprofileObj , "username&pwd", "function() { alert(“error occurred”)};"

     );

}

hwc.processDataMessage = function (incomingDataMessageValue) {

            console.log("start processDataMessage");

            if(incomingDataMessageValue.indexOf("GetProfile_findByUserAccount"){

                    var workflowMessage = new WorkflowMessage(incomingWorkflowMessage);

                    var values = workflowMessage.getValues();

                    var Name = values.getData("GetProfile_NAME_attribKey").value;

                    alert(firstName);

             }

  }

-----

1. Call test("user1").

2. Before the results of user1 come back,call test("user2").

-----

After an operation such as that described above, hwc.processDataMessage() function is called twice,

but I do not have a means distinguish between the response of the response of user1 and user2.

Is hwc.processDataMessage() always called in order ?

Thanks,

Tann

Former Member
0 Kudos

So the user is allowed to call the same function twice (or more) on the same screen?  Would it be possible to control the UI so that action is disabled until the first results come back.

Currently, the hwc.processDataMessage() is called in order, but it is not a good idea to depend on that as it is an internal detail that may or may not change in the future. 

There are other properties on the WorkflowMessage that may be able to distinguish the request. 

For example, if the action is on two different screens, you may consider comparing the values of workflowMessage.getWorkflowScreen().  Or do you see different values for workflowMessage.getHeader()?

Hybrid App Message Data Functions

Thanks,

Andrew.

Former Member
0 Kudos

Hi,Andrew.

Thank you! It useful to solve our problem!!

Answers (0)