Read selected values from a multi choice field programatically using Microsoft.SharePoint.Client namespace.

All examples I found refer to classes under Microsoft.SharePoint namespace. However, I have the SharePoint CSOM that only gives me the Microsoft.Sharepoint.Client namespace.
I need to read the selected values of a multichoice field, but not sure how to do it with classes in the namespace above.
everthing works, exept the TSQL_x0020_Reference_x0020_Numbe field.
my code looks like this:
Webweb = cont.Web;
            cont.Load(web);
            cont.ExecuteQuery();
Listsstest = web.Lists.GetByTitle("T-SQL
Code Review Tracking");
//CamlQuery query = CamlQuery.CreateAllItemsQuery();
CamlQueryquery =
newCamlQuery();
            query.ViewXml =
@"<View>
                           <ViewFields>
                                <FieldRef Name='Category'/>
                                <FieldRef Name='Review_x0020_Type'/>
                                <FieldRef Name='Review_x0020_Start_x0020_Date'/>
                                <FieldRef Name='Title'/>
                                <FieldRef Name='Location'/>
                                <FieldRef Name='Project'/>
                                <FieldRef Name='Author0'/>
                                <FieldRef Name='AssignedTo'/>
                                <FieldRef Name='TSQL_x0020_Reference_x0020_Numbe'/>
                            </ViewFields>
                         </View>"
 ListItemCollectionitems
= sstest.GetItems(query);
            cont.Load(items);
            cont.ExecuteQuery();
foreach(ListItemitem
initems)
                Output0Buffer.AddRow();
                Output0Buffer.ReviewStatus = item.FieldValues[
"Category"] !=
null? item.FieldValues["Category"].ToString()
: String.Empty;
                Output0Buffer.ReviewType = item.FieldValues[
"Review_x0020_Type"] !=
null? item.FieldValues["Review_x0020_Type"].ToString()
: String.Empty;
                Output0Buffer.ReviewDate =
DateTime.Parse(item.FieldValues["Review_x0020_Start_x0020_Date"].ToString());
                Output0Buffer.Module = item.FieldValues[
"Title"] !=
null? item.FieldValues["Title"].ToString()
: String.Empty;
                Output0Buffer.BranchLocationURL = item.FieldValues[
"Location"] !=
null? item.FieldValues["Location"].ToString()
: String.Empty;
                Output0Buffer.ProjectName = item.FieldValues[
"Project"] !=
null? item.FieldValues["Project"].ToString()
: String.Empty;
                Output0Buffer.Author = item.FieldValues[
"Author0"] !=
null? item.FieldValues["Author0"].ToString()
: String.Empty;
FieldLookupValueflvAssignedTo =
newFieldUserValue();
                flvAssignedTo = item.FieldValues[
"AssignedTo"]
asFieldLookupValue;
if(flvAssignedTo !=
null)
                    Output0Buffer.AssignedTo = flvAssignedTo.LookupValue;
varv = item.FieldValues["TSQL_x0020_Reference_x0020_Numbe"];
if(v !=
null)
                    Output0Buffer.Reason2 = v.ToString();
             Output0Buffer.SetEndOfRowset();           

Hi,
According to your description, my understanding is that you want to read the selected choice field value using Client Object Model.
In my environment, I create a list with a mutichoice fileld named "choice" and then I used the code snippet below to get the selected value in choice field.
ClientContext clientContext = new ClientContext("http://sp2013sps/sites/test1");
Microsoft.SharePoint.Client.List spList = clientContext.Web.Lists.GetByTitle("list1");
clientContext.Load(spList);
clientContext.ExecuteQuery();
if (spList != null && spList.ItemCount > 0)
Microsoft.SharePoint.Client.CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml =
@"<View>
<ViewFields><FieldRef Name='choice' /></ViewFields>
</View>";
ListItemCollection listItems = spList.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
string value = listItems[0]["choice"].ToString();
Console.WriteLine(value);
Console.ReadKey();
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]

Similar Messages

  • Reading selected values from af:selectManyListbox

    Hi
    got af:selectManyListbox in the page with the dept_id as the base attribute and dept_name as the display attribute.
    Since its multi select i'm able to read the selected values using array as per the following code
                BindingContext bc1 = BindingContext.getCurrent();
                DCBindingContainer binding1 = (DCBindingContainer)bc1.getCurrentBindingsEntry();
                    JUCtrlListBinding listBindings1 = (JUCtrlListBinding)binding1.get("DEPTVIEW1");     
                    Object str[] = listBindings1.getSelectedValues();
                    System.out.println("after  Object str[] = listBindings1.getSelectedValues();");
                    for (int i = 0; i < str.length; i++) {
                        System.out.println(str[i]);
    which is returning the dept_id s since its the base attribute
    say
    2
    3
    6
    on basis of selection
    I got to retrieve the DEPT_NAME too?
    How to fetch the DEPT_NAME which is the display attribute??
    Bindings has the DEPTVIEW1 in the variables. so i cant separately access the DEPT_NAME too from bindings.
    Thanks
    Chaya

    Hey chaya,
    I use a similar method of what you use, but i use it with selectionEvents but take a look at my code and see if it can help you:
            //get access to the master table to read selected row keys
            RichTable rt = (RichTable) selectionEvent.getSource();
            RowKeySet rks = rt.getSelectedRowKeys();
            while (selectedRowsIterator.hasNext()) {
                List rowKey = (List) selectedRowsIterator.next();
                //make the row current
                rt.setRowKey(rowKey);
                JUCtrlHierNodeBinding wrappedRow = (JUCtrlHierNodeBinding) rt.getRowData();
                Row rw = wrappedRow.getRow();
                long var_dimCoinInt = (Long) rw.getAttribute("PkCoin");
    regards,
    Frederico.

  • Unable to read selected values from selectManyListbox control

    I have selectManyListbox component in my jsp page as follows:
    <h:selectManyListbox id="allBusinessFunctions" styleClass="maintxtbox selectCampaignBox" >
    <f:selectItems value="#{pc_CreateCampaigns.bizFunctions}"/>
    </h:selectManyListbox>
    I am doing multiple selections on the component. In the same jsp page I have graphicImage component as follows:
    <h:graphicImage id="createCampaignLink" alt="Click on this" url="/theme/img/button-use.gif">
    <hx:behavior event="onclick" behaviorAction="get" targetAction="bizFunDetailsGroup"></hx:behavior>
    </h:graphicImage>
    On click of this graphicImage I am invoking a ajax call to one of the backing bean method getDisplayBizFunctions().
    I also have a panel group component as follows:
    <h:panelGroup id="bizFunDetailsGroup" styleClass="panelGroup">
    <h:dataTable id="bizFunDetails" value="#{pc_CreateCampaigns.displayBizFunctions}" var="bizFunctions" border="0">
    <h:column>
    <f:facet name="header">
         <h:outputText value="Column1"/>
    </f:facet>
    <h:outputText value="#{bizFunctions}"/>                                        
    </h:column>
    </h:dataTable>
    </h:panelGroup>
    <hx:ajaxRefreshRequest id="ajaxRefreshRequest3" target="bizFunDetailsGroup" params="allBusinessFunctions"></hx:ajaxRefreshRequest>
    In my backing bean I have a method as follows:
    public ArrayList getDisplayBizFunctions(){                         
    bizTypeSearch = (String)getRequestParam().get("allBusinessFunctions");
    System.out.println("bizTypeSearch =" + bizTypeSearch );                         
              return null;
    I am trying to read the multiple selected values of as
    getRequestParam().get("allBusinessFunctions");
    Which is returing only the first selected items value but not all..
    How can get all the selected values?

    To the point: you should have used HttpServletRequest#getParameterValues(), not getParameter().
    In this specific case: just bind the <h:selectManyListbox> 'value' property with a List<BizFunctionType> property in the backing bean.

  • Creating SharePoint Custom List using a list using a Microsoft.SharePoint.Client.ClientContext object: Lists.Add method from existing Template does not Include Template Content (include content was checked for template)

    The code below works assuming you have a list template setup called "GenTasksTemplate".
    The problem is that even though the check box to include content was checked during the creation of the template, the task items in the new list do not get populated.  What am I missing?
    using System;
    using System.Linq;
    using Microsoft.SharePoint.Client;
    protected void createSPlist(object sender, EventArgs e)
    ClientContext context = new ClientContext("https://sharepointServer/sites/devcollection/");
    var web = context.Web;
    ListTemplateCollection ltc = context.Site.GetCustomListTemplates(context.Web);
    ListCollection siteListsColection = web.Lists;
    context.Load(ltc);
    context.ExecuteQuery();
    ListCreationInformation listCreationInfo = new ListCreationInformation
    Title = "New Task from Template",
    Description = "Tasks created from custom template"
    Microsoft.SharePoint.Client.ListTemplate listTemplate = ltc.First(listTemp => listTemp.Name == "GenTasksTemplate");
    listCreationInfo.TemplateFeatureId = listTemplate.FeatureId;
    listCreationInfo.TemplateType = listTemplate.ListTemplateTypeKind;
    listCreationInfo.DocumentTemplateType = listTemplate.ListTemplateTypeKind;
    //listCreationInfo.CustomSchemaXml =
    siteListsColection.Add(listCreationInfo);
    context.Load(siteListsColection);
    context.ExecuteQuery();
    http://www.net4geeks.com Who said I was a geek?

    Yes. I can create a list with the template using the UI.  I can also create list programmatically using the Microsoft.SharePoint library within a Windows Forms Application.  If I do create a provider-hosted app referencing Microsoft.SharePoint,
    it results in a 64bit / 32bit mismatch error.  I am running SharePoint 2013 on a 64 bit Windows 2012 Server.
    The problem is that with a provider-hosted SharePoint App, I am limited to only using the Microsoft.SharePoint.Client library which is very limited.
    http://www.net4geeks.com Who said I was a geek?

  • Values from a Multi-Select in the where clause of a Select statement

    I have a web page that solicits query parameters from the user.
    The selections that the user makes will populate the WHERE clause of a Select statement.
    One of the controls on the page is a multi-select control.
    When this page posts, I would like to execute a Select statement wherein the selected values from this control appear in the .. Column IN ( <list here> ) portion of the WHERE clause.
    This is an extremely common scenario, but I cannot seem to locate a how-to or message thread that addresses this specific case.
    I have an idea that it may involve dynamic SQL or Execute Immediate, but cannot seem to pin down the answer.
    Any help would be greatly appreciated!

    anonymous - As illustrated here: Re: Search on a typed in list of values
    Scott

  • Show selected value from multi-selected parameter in crystal report

    Dear Experts!
         i would like to ask how to catch selected value from multi-selected parameter to show in report header section.
    Thanks in advance.

    Hi Dara,
    If this is a string prompt then you could simply create a formula with this code and place it on the report header:
    Join({?Prompt name},", ")
    -Abhilash

  • [Forum FAQ] SharePoint 2013: Extracting values from a multi-value enabled lookup column and merge values to a multi-value enabled column

    For some business requirements, users want to extract values from a multi-value enabled lookup column
    and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
    add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
    How to extract values from a multi-value enabled lookup column and add items to another list based
    on each separate value using SharePoint Designer 2013.
    Important actions: Loop Shape; Utility Actions
    Three scenarios
    Things to note
    Steps to create Workflow
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013.
    Important actions: Call HTTP Web Service; Build Dictionary
    Things to note
    Steps to create Workflow
    How to
    extract values from a multi-value enabled lookup column and
    add items to another list based on each separate value using SharePoint Designer 2013.
    For example, they have three lists as below. They want to
    extract values from the Destinations column
    in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
    Lookup1:
    Title (Single line of text)
    Lookup2:
    Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Important action
    1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
    Loops must also conform to the following rules:
    Loops must be within a stage, and stages cannot be within a loop.
    Steps may be within a loop.
    Loops may have only one entry and one exit point.
    2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
    Three scenarios
    We need to loop through the string returned from the look up column and look for commas. There are three
    scenarios:
    1.  No comma but string is non-empty so there is only one country.
    2.  At least one comma so there is at least two or more countries to loop.
    3.  In the loop we have consumed all the commas so we have found the last country. 
    Things to note
    There are two things to note:
    1. "Find string in string (output to Variable:index)"  will return -1 if doesn't find
    the searched for string.
    2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
    field as  "Lookup Values, Comma Delimited".
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup2.
    Add conditions and actions:
    Start the workflow automatically when an item is created.
    Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
    See the below in workflow History List:
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013
    For example, they have three lists as below. They want to find duplicate values in the Title column in
    Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
    Lookup1:
    Title (Single line of text)
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Lookup2:
    Title (Single line of text), Test (Single line of text).
    Important actions
    "Call HTTP Web Service"
    action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
    is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
    “Build Dictionary"
    action:
    The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
    The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
    The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
    Things to note
    The
    HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
    Use Get
    d/results(0)/Id form
    Variable: ResponseContent (Output to
    Variable: maxid) to get the Max ID.
    Use Set
    Variable: minid to Current List:ID to get the Min ID.
    Use Copy from
    Variable: destianation , starting at
    1 (Output to
    Variable: destianation) to remove the space.
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Test (Single line of text).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup3.
    Add a new "Build Dictionary" action
    to define the http request header:
    Add a Call HTTP Web Serviceaction, click on
    this and paste your http request.
    To associate the
    RequestHeader variable, select the Call action property,
    set the
    RequestHeaders property to
    RequestHeader:
    In the Call action, click on
    response and associate the response to a new
    variable: ResponseContent (of type Dictionary).
    After the Call action add Get item from Dictionary action to get the Max ID.
    Add Set Workflow Variable action to get the Min ID.
    Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
    Create item in Lookup2.
    The final Stage should look like this:
    Start the workflow automatically when an item is created.
    Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
    See the below in workflow History List:
    References
    SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
    http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
    Workflow actions quick reference (SharePoint 2013 Workflow platform):
    http://msdn.microsoft.com/en-us/library/jj164026.aspx
    Understanding Dictionary actions in SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
    Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
    Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/

    GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
    cancel).  I only found this out when recreating your workflow on a similar, but much more complex list set.  
    To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace.  I configured it as "Copy from
    Variable: Countries, starting at
    1 (Output to Variable: Countries), which takes care of this issue in those few cases.
    Otherwise, WOW!  AWESOME JOB!  Thanks!  :)

  • Copy selected values from a table control into another table control

    hi there,
    as seen in the subject i need to copy selected values from a table control into another table control in the same screen. as i dont know much about table controls i made 2 table controls with the wizard and started to change the code... right now im totally messed up. nothing works anymore and i don't know where to start over.
    i looked up the forums and google, but there is nothing to help me with this problem (or i suck in searching the internet for solutions)
    i have 2 buttons. one to push the selected data from the top table control into the bottom tc and the other button is to push selected data from the bottom tc into the top tc. does somebody has a sample code to do this?

    you're funny
    i still don't get it... can't believe, there is no tutorial or sample code around how to copy multiple selected rows from a tc.
    here's my code, maybe you can tell me exactly were i have to change it:
    tc1 = upper table control
    tc2 = lower table control
    SCREEN 0100:
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
      MODULE get_nfo. --> gets data from the dictionary table
      MODULE tc1_change_tc_attr.
      LOOP AT   it_roles_tc1
           INTO wa_roles_tc1
           WITH CONTROL tc1
           CURSOR tc1-current_line.
      ENDLOOP.
      MODULE tc2_change_tc_attr.
      LOOP AT   it_roles_tc2
           INTO wa_roles_tc2l
           WITH CONTROL tc2
           CURSOR tc2-current_line.
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT it_roles_tc1.
        CHAIN.
          FIELD wa_roles_tc1-agr_name.
          FIELD wa_roles_tc1-text.
        ENDCHAIN.
        FIELD wa_roles_tc1-mark
          MODULE tc1_mark ON REQUEST.
      ENDLOOP.
      LOOP AT it_roles_tc2.
        CHAIN.
          FIELD wa_roles_tc2-agr_name.
          FIELD wa_roles_tc2-text.
        ENDCHAIN.
        FIELD wa_roles_tc2-mark
          MODULE tc2_mark ON REQUEST.
      ENDLOOP.
      MODULE ok_code.
      MODULE user_command_0100.
    INCLUDE PAI:
    MODULE tc1_mark INPUT.
      IF tc1-line_sel_mode = 2
      AND wa_roles_tc1-mark = 'X'.
        LOOP AT it_roles_tc1 INTO g_tc1_wa2
          WHERE mark = 'X'.    -
    > big problem here is, that no entry has an 'X' there
          g_tc1_wa2-mark = ''.
          MODIFY it_roles_tc1
            FROM g_tc1_wa2
            TRANSPORTING mark.
        ENDLOOP.
      ENDIF.
      MODIFY it_roles_tc1
        FROM wa_roles_tc1
        INDEX tc1-current_line
        TRANSPORTING mark.
    ENDMODULE.                    "TC1_MARK INPUT
    MODULE tc2_mark INPUT.
      IF tc2-line_sel_mode = 2
      AND wa_roles_tc2-mark = 'X'.
        LOOP AT it_roles_tc2 INTO g_tc2_wa2
          WHERE mark = 'X'.             -
    > same here, it doesn't gets any data
          g_tc2_wa2-mark = ''.
          MODIFY it_roles_tc2
            FROM g_tc2_wa2
            TRANSPORTING mark.
        ENDLOOP.
      ENDIF.
      MODIFY it_roles_tc2
        FROM wa_roles_tc2
        INDEX tc2-current_line
        TRANSPORTING mark.
    ENDMODULE. 
    thx for anybody who can help with this!

  • Reading any value from table into a string (Especially date etc..)

    How would I read any value from a table into a string?
    Currently doing the following...
    data ret_val type string.
    select single (wa_map-qes_field) from z_qekko into ret_val
    where
    angnr = _angnr.
    When the source field is a date it bombs though.
    The result goes into a BDCDATA-fval.
    regards
    Dylan.

    Tried...
    1    DATA: lp_data TYPE REF TO DATA.
    2    FIELD-SYMBOLS: <value> TYPE ANY.
    3    CREATE DATA lp_data LIKE (wa_map-qes_field).
    4    ASSIGN lp_data->* TO <value>.
    5    SELECT SINGLE (wa_map-qes_field) FROM zquadrem_qekko INTO <value> WHERE angnr = _angnr.
    Complains that (wa_map-qes_field) is not defined in line 3.
    Think that the bracket thing is only available via SQL.
    What about CREATE DATA lp_data type ref to object. ?
    Would the above declaration work?
    regards

  • Assign a value from dropdownlist to input field value on BSP page

    Hi,
    I'm new to SAP and ABAP. We have a CRM project in which I have to maintain BSP pages.
    Now, coming to my problem: I have a input field with
    value = "//BTAdminH/HeaderInfo"
    This field is normally maintainable. The required function is now to set this field as not maintainable/readonly. Then, the value should be set automatically to an value, which will be selected from a dropdownListBox. After saving, the value HeaderInfo should have the same value like the selected value from the dropdownListBox.
    How can I now set the field as readonly (this should be the easier part) and
    how can I set the value for the HeaderInfo to the value of the selected value from the dropdownListBox?
    If I set it directly like this
    value = "//BTActivity/Priority"
    it is shown on the BSP page correclty, but it is not saved as HeaderInfo.
    Please help me.
    Enja

    Hello Gokul,
    test was only for test purposes! I am using as a separator the plus sign!
    But this is not the problem!
    In debugging, the local variable has the concatenated value! So, this is working!
    oncatenate ls_ddlb1-value ls_ddlb2-value ls_ddlb3-value into lv_headerinfo SEPARATED BY ' + '.
    But when I assign the value of my set_headerinfo to the local variable, then it is returning only the separator sign!!!
    if BTAdminH->GET_HEADERINFO( 'HEADERINFO' ) is initial.
        BTAdminH->SET_HEADERINFO( attribute_path = 'HEADERINFO' value = lv_headerinfo ).
      endif.
    If I declare the local variable as one of the dropdown values, then it is getting populated also for set_headerinfo
    lv_headerinfo  =ls_ddlb1-value.
    So, the assigning is also working! But it is not working, when the local variable equals more than one value! I hope that I could explained it in the right way for you!!!!
    So. why is the value for set_headerinfo not the same as the one for the local variable! The local variable has the correct value after the concatination.
    Regards
    Enja

  • How to get selected value from selectOneRadio ???

    Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
    Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
    Plzzzzzzzz i need help

    You have a datatable in which each row is a question, correct?
    Also in each row you have 5 possible answers that are in a radio, correct?
    So,
    You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
    So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
    ex:
    <h:selectOneRadio value="#{notas.selectedString}" id="rb">
    <f:selectItem itemValue="#{notas.valuesList}"/>
    </h:selectOneRadio>
    Search the web for examples like yours.

  • How to get selected value from OADefaultListBean.

    Hi All,
    How to get selected value from OADefaultListBean ?
    Thanks,

    Hi,
    To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
    OADefaultListBean list =
    (OADefaultListBean)webBean.findChildRecursive("positionsList");
    String name = list.getName();
    String[] selectedValues = pageContext.getParameterValues(name);
    To retrieve all the values in the list box, call list.getOptionsData().
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to get selected value from SelectOneChoice

    Hi,
    I'm facing a problem to get selected value from SelectOneChoice. I have valueChangeListener event on a (SelectOneChoice)item. After user makes a choice I want to store selected value in a bean property to pass it to a method.
    For example List item shows dname from dept table after user makes a choice I want to get deptno and populate into bean which I use to pass into my method.
    If I use valueChangeEvent.getNewValue() I always get negative value instead I want deptno selected. Sample code pasted below.
    public void setDeptno(ValueChangeEvent valueChangeEvent) {
    BindingContainer b = getBindings();
    OperationBinding oB = b.getOperationBinding("setDeptno");
    //Checking instance of because same method is called from another text inputText item.
    if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
    CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
    if (columnName.getId().toString().equals("deptDname")){
    JSFUtils.setManagedBeanValue("dept.deptDeptno",valueChangeEvent.getNewValue());
    }

    if your selectOneChoice has value equal to #{bindings.deptno} bound to the iterator Dept1Iterator,
    then the backing code will look more like
                    public void setDeptno(ValueChangeEvent valueChangeEvent) {
                        BindingContainer b = getBindings();
                        OperationBinding oB = b.getOperationBinding("setDeptno");
                        //Checking instance of because same method is called from another text inputText item.
                        if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
                            CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
                        if (columnName.getId().toString().equals("deptDname")){
                            FacesContext ctx = FacesContext.getCurrentInstance();
                            Application app = ctx.getApplication();
                            ValueBinding bind = app.createValueBinding("#{bindings.Dept1Iterator.currentRow}");
                            Row row = (Row)bind.getValue(ctx);
                            JSFUtils.setManagedBeanValue("dept.deptDeptno", row.getAttribute("deptno"));
                    } I haven't tested it, so it could perfectly not work at all

  • How to capture the selected values from module pool dialog list box !

    Hi experts,
    Can anyone help me out in capturing the values from the list box.
    i am able to set the values in the list box.But i am not able to capture the selected value from the list box. Always the list box name is getting as "space"
    I also tried in using the FM "VRM_GET_VALUES" but it is retireving all the values. Is there is any flag for filttering out the selected value.
    Your inputs are appreciated.
    Thanks,
    Vijay.

    Along with the PBO and PAI event, add a POV event in the flow logic of the screen
    DEMO_DROPDOWN_LIST_BOX -is a good demo example.
    PROCESS ON VALUE-REQUEST.
    FIELD structure_name-field_name MODULE create_dropdown_box.
    In the report :
    MODULE create_dropdown_box INPUT.
      SELECT carrid carrname
                    FROM scarr
                    INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'CARRID'
                value_org       = 'S'
           TABLES
                value_tab       = itab_carrid
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
      ENDIF.
    ENDMODULE.
    In the layout, assign a Function Code , for eg : 'SELECTED' to the listbox and lets say name of the field is SDYN_CONN-CARRID. So in the PAI module,
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'SELECTED'.
          MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
      ENDCASE.
    ENDMODULE.
    sdyb_conn-carrid will contain your selected field

  • Getting selected values from selectManyChoice component inside valueChangeListener

    Hwo do I get the selected values from the selectManyChoice component inside the valueChangeListener.
    The API docs for valueChangeEvent.getNewValue() show the return type as java.lang.object. This is good for single value what does it return in case of multiple values.
    My drop down has string values so I am expecting a set of string values.

    JDev - 11.1.2.3
    public void onRegionSelect(ValueChangeEvent event) {
    event.getComponent().processUpdates(FacesContext.getCurrentInstance());
    if (!PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId())) {
    event.setPhaseId(PhaseId.INVOKE_APPLICATION);
    event.queue();
    } else {
    List<Object> values = Arrays.asList(event.getNewValue());
    System.out.println("Value changed ==>> "+values.size());
    DCBindingContainer dc =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iter = dc.findIteratorBinding("RegVO1Iterator");
    ViewObject vo = iter.getViewObject();
    StringBuffer regions = new StringBuffer();
    for(Object index : values){
    String iIndex = (String)index;
    Row row  = vo.getRowAtRangeIndex(Integer.parseInt(iIndex));
    regions.append((String)row.getAttribute("Region")+",");
    String reg = regions.toString();
    if(reg.endsWith(","))
    reg = reg.substring(0,reg.lastIndexOf(","));
    System.out.println(reg);

Maybe you are looking for

  • SMD agent not starting correctly FAIL: NIECONN_REFUSED (Connection refused)

    I am getting the following message when I start the agent.  I don't see any errors except for this, and when I try to connect it in agent_adminstration, it never connects.  Just eventually times out after 30 mins. FAIL: NIECONN_REFUSED (Connection re

  • Problem Opening Text Photos

    I've had many occasions when someone texts me a photo and as I receive it, it says "Download".  I tap "Download" but nothing happens and I am unable to view the photo.  Since this is also a function I use for my work, it's very important to me what I

  • Panasonic 24p footage - workflow in CS4

    Hi there, Although it's my first post on this forum I've been reading and browsing for answers to my questions before – it's not the case for me to give advises, not yet at least!!! But this thread just confuses me a lot and I don't think I fully und

  • Spam/Scam e-mail

    Got this e-mail. FYI

  • Restricting User to Enter Only Date Value

    Dear Expertsl, Can we restrict users to insert only date value (in RRMMDD format ) in a column whose data type is number, Note that i cannot modify the column because there are already values entered in the column and cannot delete it. Regards