cancel
Showing results for 
Search instead for 
Did you mean: 

Openui getting external Data

Former Member
0 Kudos

Hello experts;

My external data in agentry like this

and my openui code like this

this is how i get with a rule

However, I can't get "new1 and new2" what is the problem. Do i need to call getExtentionString() from somewhere? i guess not.

p.s: I also didnt get "no value" it returned nothing.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

the problem was my server. I changed my server with new version. Now everything working thank you all.

Answers (1)

Answers (1)

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Renos,

Try to start launching the modified client with the open UI class in debug mode from Eclipse.

Set a breakpoint in the beginning of each method from the adapter class that you created and assigned to your field to check if something is going wrong there.

The getExtensionString should be executed at least once when you show the screen with a field containing the update rule

Former Member
0 Kudos

I put textffield in getExtentionString()

like

textfield.addtext("called");

to see is my function  calling?

However, the function didn't called. my textfiled was also empty.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Renos,

You can for example create a string field in the same detail screen and use the external value as an update rule. In my example I have a button field Z_RFIDButton, and I have a field called Z_RFIDString, the 2nd field is getting the value from the first one with the following update rule:

Former Member
0 Kudos

Hi Marçal,

Yes I used same rule to get external value. However,it is empty. Which adaptor did u use. I used StringDisplayadapter. Fieldadapter is the abstract class all open UI adapter. So the problem can be my adapter? I guess not. Can you say which versions did u used?

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Renos,

Now I'm using ButtonDisplayAdapter (with Agentry field type being a button), but I also tested with StringDisplayAdapter (with Agentry field type being a String). In both cases should work...

I'm not sure how else can I help. Maybe you should post all your adapter code.

Former Member
0 Kudos

Hi Marçal, firstly thanks for your attention.

This is my openui codes

package com.sap.mobile.platform.client.openui.extensions;

import android.content.Context;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

import android.widget.LinearLayout;

import android.widget.TextView;

import com.sap.mobile.platform.client.openui.adapters.StringDisplayAdapter;

import com.sap.mobile.platform.client.openui.models.StringDisplayModel;

import com.sap.mobile.platform.core.openui.ActionEnableType;

import com.sap.mobile.platform.core.openui.ActionResult;

public class ZMyexternaldata extends StringDisplayAdapter{

  StringDisplayModel _model;

  Context _context;

  TextView text;

  LinearLayout layout;

  String action;

  Button btn;

  TextView txtdebug;

  ActionResult ar;

  public void initialize(StringDisplayModel model, Context context) {

  // TODO Auto-generated method stub

  _model=model;

  _context=context;

  }

  @Override

  public View getView() {

  //ExternalValue22=_model.executeAgentryAction("ShowMessage").toString();

  // TODO Auto-generated method stub

  layout=new LinearLayout(_context);

  text=new TextView(_context);

  btn=new Button(_context);

  text.setText("my value"+_model.getValue());

  txtdebug=new TextView(_context);

  btn.setOnClickListener(new OnClickListener() {

  @Override

  public void onClick(View arg0) {

  // TODO Auto-generated method stub

  //ActionEnableType enableType=_model.getAgentryActionEnableState("ShowCollection");

  

  ActionEnableType aet = _model.getAgentryActionEnableState("OpenZMYStringEdit");                                                        

   if (aet.name().equalsIgnoreCase(ActionEnableType.ActionEnable.name()))

   {

    ar = _model.executeAgentryAction("OpenZMYStringEdit");

   }

   txtdebug.setText(" tet"+aet.name());

  }

  });

  layout.addView(btn);

  layout.addView(text);

  layout.addView(txtdebug);

  return layout;

  }

  @Override

  public String getExtensionString(String name)

  {

     if (name.equalsIgnoreCase("externalvalue1"))

     {

    

      return "new1";

    

     }

     else if (name.equalsIgnoreCase("externalvalue2"))

     {

    

      return "new2";

     }

    

     else

     {

    

      return "no value!";

     }

  }

}

*************** txtdebug.setText(" tet"+aet.name());  show me that message "tetActionNoOperation"

also my external fields return null.

Former Member
0 Kudos

getExtensionString didnt called why?

I dont know maybe i have some configuration settings problem.I'm stuck!!

Marçal_Oliveras
Active Contributor
0 Kudos

Is the getView method executed when navigating to the screen?

And the onClick() method? Try to comment the lines regarding the call to the action and after that, in the same method try to add the line _model.processInput();

Former Member
0 Kudos

yes  getView method executed but getExtentionString dont.