Problem with the return value from a tablemodel after filtering

I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
**** This is the code to fill the jtable
DefaultTableModel modelo=(DefaultTableModel)this.jTable1.getModel();
while(rs.next()){
Object[] fila= new Object[2];
fila[0]=rs.getObject("id_categoria");
fila[1]=rs.getObject("nombre");
modelo.addRow(fila);
this.jTable1.getColumnModel().removeColumn(this.jTable1.getColumnModel().getColumn(0));
// I delete the first column because is a ID, I dont want that the user see it. the value is only for me**** this is the method to filter from the jtextfield
private void FiltrarJtable1() {
TableRowSorter sorter = new TableRowSorter(this.jTable1.getModel());
sorter.setRowFilter(RowFilter.regexFilter("^"+this.jTextField1.getText().toUpperCase(), 1));
this.jTable1.setRowSorter(sorter);
this.jTable1.convertRowIndexToModel(0);
}*** this is the method that return the ID (id_categoria) from the tablemodel
private void SeleccionarRegistro(){
if(this.jTable1.getSelectedRow()>-1){
String str_id =this.jTable1.getModel().getValueAt(this.jTable1.getSelectedRow(),0).toString();
int_idtoreturn=Integer.parseInt(str_id);
this.dispose();
}else{
JOptionPane.showMessageDialog(this,"there are no records selected","Warning!",1);
}Who I can solve this problem?

m_ilio wrote:
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
You're right in that you have to use convertRowIndexToModel(), but you are using it wrong. That method takes as input the index of a row in the view, i.e. the table, and returns the corresponding row in the underlying TableModel. No data is changed by the call, so this:
this.jTable1.convertRowIndexToModel(0);is meaningless by itself.
What you need to do is the following:
int selectedRow = this.jTable1.getSelectedRow(); // This is the selected row in the view
if (selectedRow >= 0) {
    int modelRow = this.jTable1.convertRowIndexToModel(selectedRow); // This is the corresponding row in the model
    String str_id =this.jTable1.getModel().getValueAt(modelRow, 0).toString();
}Hope this helps.

Similar Messages

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • How to Sort by the length of the returned value from a query.

    Hi,
    I was wondering if it is possible to sort by the length of the returned value from a query?
    For example if I want to get a list of people with the name 'Samuel', I would like to short by how short the length of the whole name is.
    Sort by length of the name in SQL
    Samuel Syda
    Samuel Indranaka
    Samuel Johnsons
    Samuel Longhenderson
    Thank you.

    Hi,
    Sorting is done by an ORDER BY clause at the end of the main query.
    In most cases, you can ORDER BY any expression, even f it is not in the SELECT clause.  In this case, it sounds like you just need:
    ORDER BY  LENGTH (name_column)
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Post your query, using an ORDER BY clause like the one above, and point out where that query is producing the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • Problem with Bapi_po_Getdetail return values

    We have developed a web service in asp.net to get the details of a particular purchase order number calling Bapi_po_Getdetail. The input parameters that we pass are:
    string  ITEMS = “X”
    string PURCHASEORDER= “<purchase order number>”
    But when we debug and check the return values from the bapi, BAPIEKPO Table doesn’t have any data, it is null.
    Could someone help us, please?

    Please initialize the BAPIEKPOTable bedore call. Passing null allways returns null.
    NCo:
    string ITEMS = “X”
    string PURCHASEORDER= “<purchase order number>”
    BAPIEKPOTable result = new BAPIEKPOTable();
    proxy.Bapi_po_Getdetail(ITEMS, PURCHASEORDER, ref result);
    Soap Processor / Web Service Wizard
    string ITEMS = “X”
    string PURCHASEORDER= “<purchase order number>”
    BAPIEKPO[] result = new BAPIEKPO[0];
    proxy.Bapi_po_Getdetail(ITEMS, PURCHASEORDER, ref result);

  • How to store the return value from a select list in page item ?

    I'm sorry, I'm sure you will all flame me for this (and its long too :-(. I'm still trying to pick this up and havn't had time to read manual and this forum and up against the clock (as usual), but this must be something thats simple to do, otherwise why have 2 cols on LOV (display text and return value.
    normal kind of thing - master /detail, a master table and a detail table, master.id is PK in master, master.name is the name of the master item. detail.id is pk in detail, detail.mid is foreign key to master.id. I have a tabular report that displays a join of cols from master and detail, with 2 cols being links, one is a link on master.name, that passes master.id to page P1 and it displays a row from master. The other col displays detail.name and passes detail.id to page P3, P3 displays a row of the detail table.
    I want to populate a LOV with possible master.name values, but display the name of the current P3_MID value (from detail.mid). Then a user can pick a different master and it needs to update P3_MID so on submit it updates the row.
    I just can't seem to see in the manual how you can specify where the return value on a LOV goes?
    As I said, sorry for long post and not having had time to read docs correctly - someone just point me at the subject matter somewhere, please.

    Sorry, I was trying to be to complex and obviously APEX is just too damn cleaver - I figured out how this works - basically APEX pulls the LOV and then matchs the mid to it to display the correct name - simple and easy - just me making it difficult

  • Webservice : problem with Base64 returned value

    Hello all,
    We are calling a webservice from a Flex2 application.
    When the returned value does not contain accentuated letters,
    we receive the value "as-is", everything is OK.
    When there is at least one accent, the result is
    automatically Base64 encoded by the server, and the
    xsi:type="n2:base64 is specified in the XML answer.
    The problem is that Flex2 does not Base64 decode the returned
    string, ans we cannot get the right value.
    We do not think that the problem is on the server, because we
    tryied to use 2 other webservice clients, and they worked well.
    We wonder if Flex2 can handle Base64 encoding on Webservice
    results or not.
    We thought abut using the Base64 decoder class, but it won't
    work because the result if not *always* Base64 encoded (depending
    if it contains some chars or not).
    Is there any solution to this issue ? If it can help, I paste
    the XML returned by the server at the end of this message.
    Thank you for your help.
    MiF
    <?xml version="1.0" encoding="UTF-8" ?>
    <env:Envelope xmlns:xsd="
    http://www.w3.org/2001/XMLSchema"
    xmlns:env="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance">
    <env:Body>
    <n1:GetArticleResponse xmlns:n1="urn:ActionWebService"
    env:encodingStyle="
    http://schemas.xmlsoap.org/soap/encoding/">
    <return xmlns:n2="
    http://schemas.xmlsoap.org/soap/encoding/"
    xsi:type="n2:base64">PD94bWwgdmVyc2lvbj0iMS4xIiBlbmNvZGluZz0iSVNPLTg4NTktMSI/Pgo8
    YXJ0aWNsZXM+CiAgPGFydGljbGU+CiAgICA8aWQ+MTwvaWQ+CiAgICA8Y29k
    ZT5NaXRjaDwvY29kZT4KICA8L2FydGljbGU+CiAgPGFydGljbGU+CiAgICA8
    aWQ+MjwvaWQ+CiAgICA8Y29kZT5Qb2xvPC9jb2RlPgogIDwvYXJ0aWNsZT4K
    ICA8YXJ0aWNsZT4KICAgIDxpZD4zPC9pZD4KICAgIDxjb2RlPkvpa+k8L2Nv
    ZGU+CiAgPC9hcnRpY2xlPgo8L2FydGljbGVzPgo=</return>
    </n1:GetArticleResponse>
    </env:Body>
    </env:Envelope>

    You should use cast_to_varchar2 regardless what is source of base64_encode.
    Because base64-value consists of single byte ASCII-characters.

  • Router not seeing the return value from a webservice

    Hello. I have two input fields and a button that calls a web service, is an action that is passed to a router.
    So it looks like this form-->execute web service-->router-->decision
    I'm passing back a string of success or failure as follows:
    @WebMethod
    public String doLogin(String userName, String password)
    if(userName.equals("1"))
    return "failure";
    return "success";
    It executes the method fine, but the router doesn't see the return value correctly. It always evaluates to false (which is the default)
    My text boxes and button is defined as follows:
    <af:inputText value="#{bindings.arg0.inputValue}"
    label="Username:"
    required="#{bindings.arg0.hints.mandatory}"
    columns="#{bindings.arg0.hints.displayWidth}"
    maximumLength="#{bindings.arg0.hints.precision}"
    shortDesc="#{bindings.arg0.hints.tooltip}">
    <f:validator binding="#{bindings.arg0.validator}"/>
    </af:inputText>
    <af:inputText value="#{bindings.arg1.inputValue}"
    label="Password:"
    required="#{bindings.arg1.hints.mandatory}"
    columns="#{bindings.arg1.hints.displayWidth}"
    maximumLength="#{bindings.arg1.hints.precision}"
    shortDesc="#{bindings.arg1.hints.tooltip}">
    <f:validator binding="#{bindings.arg1.validator}"/>
    </af:inputText>
    <af:commandButton actionListener="#{bindings.doLogin.execute}"
    text="doLogin"
    disabled="#{!bindings.doLogin.enabled}"
    action="doLogin"/>
    </af:panelFormLayout>
    My loginpagedef.xml is as follows:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.51.88" id="loginPageDef"
    Package="customerportal.pageDefs">
    <parameters/>
    <executables>
    <variableIterator id="variables">
    <variable Type="java.lang.String" Name="doLogin_Return"
    IsQueriable="false" IsUpdateable="0"
    DefaultValue="${bindings.doLogin.result}"/>
    <variable Type="java.lang.String" Name="doLogin_arg0"
    IsQueriable="false"/>
    <variable Type="java.lang.String" Name="doLogin_arg1"
    IsQueriable="false"/>
    </variableIterator>
    </executables>
    <bindings>
    <methodAction id="doLogin" RequiresUpdateModel="true" Action="invokeMethod"
    MethodName="doLogin" IsViewObjectMethod="false"
    DataControl="OracleWebServices"
    InstanceName="OracleWebServices"
    ReturnName="OracleWebServices.methodResults.doLogin_OracleWebServices_doLogin_result">
    <NamedData NDName="arg0" NDValue="${bindings.doLogin_arg0}" NDType="java.lang.String"/>
    <NamedData NDName="arg1" NDType="java.lang.String"
    NDValue="${bindings.doLogin_arg1}"/>
    </methodAction>
    <attributeValues IterBinding="variables" id="arg0">
    <AttrNames>
    <Item Value="doLogin_arg0"/>
    </AttrNames>
    </attributeValues>
    <attributeValues IterBinding="variables" id="arg1">
    <AttrNames>
    <Item Value="doLogin_arg1"/>
    </AttrNames>
    </attributeValues>
    </bindings>
    </pageDefinition>
    What am I doing wrong? I can never seem to get the router to view the result coming back from the web service. Thanks in advance!

    Hi,
    Can you try this
    <method-call id="DepartmentCheck">
    <method>#{bindings.DepartmentCheck.execute}</method>
    <return-value>#{pageFlowScope.checkResult}</return-value>
    <outcome>
    <fixed-outcome>result</fixed-outcome>
    </outcome>
    </method-call>
    <router id="routerReturnCheck">
    <case>
    <expression>#{pageFlowScope.checkResult==true}</expression>
    <outcome>succes</outcome>
    </case>
    <default-outcome>return</default-outcome>
    </router>
    just put the result of a method in pageFlowScope variable then the flow case go the router where you evaluate the variable
    hope this helps

  • Is anyone else having problems with the overdrive app not working right after new apple update

    I am having problems with the overdrive app.  I am only allowed to read about twenty pages of a book and then it tries to load more pages but does not.  I have reinstalled the app but have the same problem. Any ideas.

    Have to talked to the developer? Gone to their site? Do they have an update out for the newer OS?

  • Problem with retrieving a value from the import parameter of a method

    Hi Friends,
    I have a problem accessing the field.
    I have a import paramter in the method of my Z class. The import paramter is of type ANY.
    In my method I get the value of this import paramter as
    . In this I have a field Catalog Id which is a z field.
    How should I retrieve the value of this catalog Id from this importing parameter?
    Regards,
    Raju

    Hi Friends
    Can anyone tell me whether this is a structure or a Class refernce, so that I can access the field in that.
    Regards,
    Raju

  • .MSG files. Problem with getting requested values from crawled properites

    Hi
    I have a lot of msg files on my file server. I use SharePoint Enterprise Serach engine to crawl all these MSGs.
    I would like to get extra managed properties out of these files. I am most interested in getting Mail:5(text) / Mail:12(Date and Time) / Mail:53(Date and Time) from MAIL category in Managed Properties.
    This thread is very similar to one already posted by SpinnerUp:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/82d69df0-5cb2-4e51-a485-34209e111f4b/problem-with-crawling-msg-files-doesnt-seem-to-return-requested-values-from-crawled-property
    Please be aware that I do not use Public Folders. These MSGs are exproted from Outlook and are stored on File Server not Exchange.
    I tried to link Crawled Properties to new property however I cannot get any results back.
    Thank you for you help.
    Regards, Marcin (Please mark as helpful or answered if it helps)

    Thank you for your replay.
    However I am not keen to write custom connector at this stage.
    Is it possible to simply get "Subject", "Sent", "Received" info from msg file and then map it to managed properties.
    Does SharePoint create any crawled properties which contain information about let's say "Subject" which then can be used to create managed properties?
    I tried playing with "MAIL" properties however I cannot get them to work. I guess this is because the file is a msg file rather than mail which is stored in Exchange Public Folder.
    Regards, Marcin (Please mark as helpful or answered if it helps)

  • LOV problem with multiple return values.

    I created a ViewObject and in it a transient attribute.
    I create a ViewAccessor for another field and a LOV for it (default InputText with Lov Value).
    In List Return Values I added also my tranient attribute in order to receive another attribute from the accesor VO.
    When I run it from the Application browser I see my transient attribute emtpty even if the "source" attribute is not empty.
    If I change the value from the LOV the source value changes bit the transient is still empty.
    What's wrong ?
    Tks
    Tullio

    Repost.

  • JTree ignores the return value from shouldYieldFocus

    I have a JTree component with my own custom DefaultTreeCellEditor which in turn uses my custom JTextField as an editor.
    I have attached the InputVerifier to the JFieldText and when user is editing node my code inside shouldYieldFocus method of InputVerifier that returns false if the node text does not match my criteria.
    I have noticed that when I click on any other JTree node (different then what I am editing now) the JTree removes my JTextField editor despite of the �false� value that I return from shouldYieldFocus.
    How can I force JTree to stay in editor until the text entered passes my validation criteria?
    Thanks in advance.
    JD

    store return value in tag class property and then use bean:setProperty, bean:getProperty.

  • Problems with the WD2GO app from Western Digital

    I have a Western Digital Mybooklive and have downloaded the WDPhoto and WD2Go apps.
    The WDPhto app works perfectly, however the WD2Go app doesnt.
    I have been in discusson with WD and they have put forward numerous suggestions but I have found nothing that works.
    They belive the proble is with the Ipad, although I am not convinced.
    When I launch the app, I get a Mybooklive icon to sekect.
    After selecting the mybooklive I can see all my public shares.
    If I click on one I see the next level in the folder structure but after this when I click on a folder the Ipad gives the busy circle and eventaually I get the message
    "Device Offline".
    If I the come out of the app and go back in I get the "Device offline " message when I click on the Mybooklive icon.
    I can get access to the Mybooklive from my andcroid phone both within my own wifi neetwork and using 3G.
    So I know that port forwarding on the Mybooklive is working properly as the android phone and router and mybooklive all talk to each other.
    Has anyone got a reason why the Ipad has these issues.

    I had exactely the same problems you have described! No useful help from WD assistance but the problem is quite well known between the users and not so rare.
    I have found the solution of my problems following the suggestions you can find here http://community.wd.com/t5/WD-Mobile-Apps/WD-2Go-App-iPad-amp-iPhone/m-p/538735# M2125
    Now everything is OK!
    Bye

  • Parsing the return value from a http request into a xml document?

    suppose a url "http;//abc.com/index.asp" that return a string like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <bbsend>
    <title>xml testing</title>
    - <record>
    <sender>111111</sender>
    <date>2004-01-05 04:11:44</date>
    <message>yes!</message>
    </record>
    - <record>
    <sender>22222222</sender>
    <date>2004-01-14 01:06:31</date>
    <message>A</message>
    </record>
    </bbsend>
    how can i parsing this return value into a xml document???
    i try something like this:
    URL url = new URL("http://abc.com/index.asp");
    HttpURLConnection http = (HttpURLConnection)url.openConnection();
    DataInputStream in = new DataInputStream(http.getInputStream());               
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse(in);
    System.out.println(document.getNodeValue());
    But fail , can anyone help

    do u mean get the xml content??
    i am doing a project with BBSend
    [email protected]

Maybe you are looking for