CFGRID Selected Item as Variable

Is it possible to set the value of a selected item in a
cfgrid to a variable?
I have tried this but it does not work:
<cfset UpdateID={recipegrid.selectedItem.RecipeID}>
(Throws an error)
also tried:
<cfset UpdateID="{recipegrid.selectedItem.RecipeID}">
(Just sets the variable to the string
{recipegrid.selectedItem.RecipeID} not the actual value from the
selected row.)
or
<cfset UpdateID='{recipegrid.selectedItem.RecipeID}'>
(Does the same as above.)
How can I do this?

Your attempts don't work because they assign the Coldfusion
variable
UpdateID an Actionscript value
{recipegrid.selectedItem.RecipeID}.
Use cfinput's bind attribute. For example, the following code
binds the Actionscript value {recipeGrid.selectedItem.recipeID} to
the Coldfusion variable form.UpdateID when the form is submitted.
<cfif isDefined("form.UpdateID")>
UpdateID: <cfoutput>#form.UpdateID#</cfoutput>
</cfif>
<cfset recipes = "pasta,salad,meat">
<cfset ids = "1,2,3">
<cfform name="recipes" format="flash"
action="#cgi.script_name#">
<cfgrid name="recipeGrid">
<cfgridcolumn name="recipeID" header="Recipe ID">
<cfgridcolumn name="recipe" header="Recipe">
<cfloop index="i" from="1" to="#ListLen(recipes)#">
<cfgridrow data ="#ListGetAt(ids, i)#,#ListGetAt(recipes,
i)#">
</cfloop>
</cfgrid>
<cfinput name="UpdateID" type="text" label="Update ID"
width="100" bind="{recipeGrid.selectedItem.recipeID}" />
<cfinput name="sbmt" type="submit" value="Send">
</cfform>

Similar Messages

  • Beginners question - making sense of form, item, pane & variable (with relation to where data is stored in the SQL database)

    Hi Everyone,
    I am new to writing reports (SQL code) for SAP, however I am aware that inside SAP Business One it is necessary to enable System Information (from the View menu) in order to see which tables (and related table attributes / column names) are related to various aspects of the various SAP 'modules' (e.g.: A/R Invoice).
    Using an A/R Invoice as an example I can see at the row (or line) level that an item with the description of 'Opening Balance Transfer' is contained in the table INV1, within the attribute (or column) called Dscription.
    However not every 'on screen object' shows a table / attribute. For example in the same A/R Invoice if I hover my mouse over the Balance Due field all I see is Form related information.
    My question is 'How do I make sense of the Form, Item, Pane, Variable information?', with relation to where data is stored within the SQL database?
    Links to online tutorials explaining how this feature of SAP Business One will be much appreciated, along with any personal advice regarding working with this information.
    Any (and all) help will be greatly appreciated.
    Kind Regards,
    David

    Hi David,
    1.Here I am explaining use of each field except pane
    a. Form ---> Used in additional authorization creator
    b. Item, column--->Useful in creating Formatted search queries (FMS)
    c. Variable --> Some of the field values based on another values. ie. indirect values.
    d. INV1---Table name
    2. How to get variable?
    As per your second attachment, to get balance due ,you need doc total field from OINV table. For example,
    SELECT T0.[DocNum], T0.[DocTotal] FROM OINV T0 WHERE T0.[DocNum] = 612004797
    Thanks & Regards,
    Nagarajan

  • Using value of selected item list

    I'm working on existing code. I want to use the value of a selected item in a list to use it in a query. So, the corresponding records should be displayed in a subform when an item of the list is selected. This is the code i'm using:
    This is the code i use to populate the list
    DECLARE
    locatienaam varchar(100);
    locid number;
    recordcount number;
    i number;
    correct NUMBER;
    hList ITEM := Find_Item('LIST_LOCATIE');
    iRC PLS_INTEGER := 0;
    currValue VARCHAR2(60); /* increase if required*/
    BEGIN
    --vraag het bijhorende ID op van de geselecteerde locatie.
    currValue := Name_In('LIST_LOCATIE');
    FOR i IN 1..Get_List_Element_Count(hList) LOOP
    IF currValue = Get_List_Element_Value(hList,i) THEN
    iRC := i;
    break;
    END IF;
    END LOOP;
    locid := GET_LIST_ELEMENT_VALUE('LIST_LOCATIE', iRC);
    locatienaam := GET_LIST_ELEMENT_LABEL('LIST_LOCATIE', iRC);
    Below the code i use to make the query
    SET_BLOCK_PROPERTY('V_KALENDER',DEFAULT_WHERE,'(BEGINDATUM BETWEEN '||''''||:V_KALENDER.TIJDSTIP1 ||'''AND '||''''||:V_KALENDER.TIJDSTIP2||''') AND (NAAM=:locatienaam)');
    GO_BLOCK('V_KALENDER');
    Execute_Query;
    I get the message: "unable to resolve reference to locatienaam"
    The subform is populated with all the records between the two dates of all the locations, not only by the selected location.

    Hi,
    Welcome to the forum!
    If locatienaam is a local variable, don't use a colon (:) to reference it.
    You didn't say
    IF :currValue = Get_List_Element_Value(:hList,:i) THEN so why should you say
    :locatienaam?

  • Multi-select prompt and variable

    Hello!
    I have a table function (which is my data source) that has a number of input parameters and the problem is with multi-select prompt because it doesn't support setting a value in a variable (OBIEE 10.1.3.4.1.). Can I somehow get a list of selected items from multi-select prompt and pass it as one string (value) to my request variable? Or maybe you have any other idea?
    I've searched old posts but I couldn't find solution to my problem regarding this issue.
    Tnx a lot!

    Hi,
    This post will solve your problem;
    http://www.rittmanmead.com/2009/11/oracle-bi-ee-10-1-3-4-1-multi-select-prompts-string-aggregation/
    Good Luck,
    Daan Bakboord
    httP://obibb.wordpress.com

  • Script to find name of swatch pattern of selected item

    I'm confused on the code to find the name of swatch pattern of selected item. As an example, the following code works to find the name of a selected item.
    var newItem;
    var docSelected = app.activeDocument.selection;
    if ( docSelected.length > 0 ) {
    for ( i = 0; i < docSelected.length; i++ ) {
    var swatchRefName=docSelected[i].name;
    alert(swatchRefName);
    else {
    alert( "Please select one or more art objects" );
    To find the swatch name, my idea would be to change
    var swatchRefName=docSelected[i].swatch.name;
    obviously this doesn't work or many other versions I've tried, Can any one help? Thank You.

    Hi Basva,
    There might be an easier way, but this should work:
    foreach($item in $list.Items)
    $minor = 0
    $major = 0
    foreach($version in $item.Versions)
    if($version.Level -eq "Draft")
    $minor += 1
    else #Assume Level must be Published
    $major += 1
    #The variables $minor and $major will now hold
    #the correct number of versions for this item

  • Af:tree selected item

    I want to display the selected item from a tree (and to store this into a variable). I tried with selection_listener, but I don't know exactly what to write in the bean. The disclosed_row_keys is used to expand all nodes.
    <af:tree value="#{bindings.ConfigTreeParent2.treeModel}"
    var="node"
    rowSelection="single" id="tree1"
    selectionListener="#{left_tree.selection_listener}"
    disclosedRowKeys="#{left_tree.disclosed_row_keys}">
    <f:facet name="nodeStamp">
    <af:outputText value="#{node}"/>
    </f:facet>
    </af:tree>
    Thanks,
    vio

    Hi vio,
    The method signature for selectionListener is
    public void someMethodName(SelectionEvent ev);
    The selection event contains the selected row keys (well actually it contains the delta which should be improved imho like oldSelection and newSelection, but in the case of single selection, you can simply use the added list more or less), you can then extract the data associated with each row keys. So, in your case, I suggest you inject the TreeModel in your bean. Here's an example:
    In the code:
    public class MyTreeController
        private TreeModel model;
        private MySelectionManager selectionManager;
        public TreeModel getTreeModel()
            return model;
        public void setTreeModel(TreeModel model)
            this.model = model;
        public MySelectionManager getSelectionManager()
            return selectionManager;
        public void setSelectionManager(MySelectionManager manager)
            this.selectionManager = manager;
        public void selectionPerformed(SelectionEvent ev)
            Object selected = getFirstRowKey(ev.getAddedSet());
            if (selected == null)
                Object unselected = getFirstRowKey(ev.getRemovedSet());
                if (selectionManager.isSelected(getRowData(unselected)))
                    selectionManager.setSelection(null);
            else
                selectionManager.setSelection(getRowData(selected));
        private Object getFirstRowKey(RowKeySet set)
            for (Object key : set)
                return key;
            return null;
        private Object getRowData(Object rowKey)
            TreeModel model = getTreeModel();
            Object oldRowKey = model.getRowKey();
            try
                model.setRowKey(rowKey);
                return model.getRowData();
            finally
                model.setRowKey(oldRowKey); // Always restore the state
    public class MySelectionManager
        private Object selection; // Or another more precise type
        public Object getSelection()
            return selection;
        public boolean isSelected(Object data)
            return selection != null && selection.equals(data);
        public void setSelection(Object selection)
            this.selection = selection;
    }In the faces-config.xml
    <managed-bean>
      <managed-bean-name>selectionManager</managed-bean-name>
      <managed-bean-class>MySelectionManager</managed-bean-class>
      <managed-bean-scope>pageFlow</managed-bean-scope> <!-- That one can be persistent across requests -->
    </managed-bean>
    <managed-bean>
      <managed-bean-name>treeController</managed-bean-name>
      <managed-bean-class>MyTreeController</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
    <!-- request scope is important here since we don't know the exact lifespan of bindings.ConfigTreeParent2.treeModel -->
      <managed-property>
        <property-name>selectionManager</property-name>
        <property-class>MySelectionManager</property-class>
        <value>#{selectionManager}</value>
      </managed-property>
      <managed-property>
        <property-name>treeModel</property-name>
        <property-class>org.apache.myfaces.trinidad.model.TreeModel</property-class>
        <value>#{bindings.ConfigTreeParent2.treeModel}</value>
      </managed-property>
    </managed-bean>In your page:
    <af:tree value="#{treeController.treeModel}"
             var="node"
             id="tree1"
             rowSelection="single"
             selectionListener="#{treeController.selectionPerformed}"
             disclosedRowKeys="#{left_tree.disclosed_row_keys}">
      <f:facet name="nodeStamp">
        <af:outputText value="#{node}"/>
      </f:facet>
    </af:tree>Note that I preferred to use the tree model from the bean rather than using directly the databindings here. I did so to improve reusability and declarativity of the page as you could now simply alter the injected tree model within the faces-config to have your page point on a completely different data source.
    Regards,
    ~ Simon

  • Getting a lists selected item itemRenderer's properties

    Is there a way to get a Spark List's selectedItem itemRenderer's contentToGlobal x and y and it's height values?
    Thanks,
    John

    Hello Shongrunden;
    Thanks again for your help, if you don't mind me asking a couple of more questions...
    - With a scrollable Spark List, if a selected item is partially in view, is there a method to get just the visible height of the itemRenderer?
    - Also, on my custom paged List component, with a custom itemRenderer and useVirtualLayout = true, after the list data is retrieved a resultHandler is called, in this I then call your getRendererCoordinates function.  I also call  getRendererCoordinates() in a listChangeHandler.
    After the resultHandler calls getRendererCoordinates, even though the dataGroup is showing the proper number of elements, and I set the list.selectedIndex to 0, the renderer variable created in;
    var renderer:IVisualElement = list.dataGroup.getElementAt(list.selectedIndex);
    the renderer var returns null on the initial display called from the resultHandler, but ... it works perfect on on the listChangeHandler and subsequent page displays.  So it seems the renderer is not finished being drawn when getRendererCoordinates is being called from the resultHandler, but subsequent page displays work probably because the renderer has already been drawn.  I've tried callLater(getRendererCoordinates) but since nothing else is going on it won't trigger.  I did not see an event that can be dispatched from IVisualElement after it is completely drawn that I can use to call getRendererCoordinates.
    Any suggestions?
    Thanks again for your help and time,
    John

  • WARNING: ADFv: Could not find selected item matching value ...

    Using Windows JDev 11.1; I have an entity object with an attribute which has a LOV configured to supply a select-one-choice render. The LOV query requires that a bind variable be supplied. When creating a new record in the entity via the VO, I can use the ViewImpl to create a new row, retrieve the RowSet which corresponds to the attribute LOV query, set the named where clause parameter, and I'm away. When updating however, I'm getting the following error reported:
    09/12/2009 2:44:04 PM oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding getInputValue
    WARNING: ADFv: Could not find selected item matching value EMPLOYER of type: java.lang.String in the list-of-values.
    I can't supply the bind variable value before the row is instantiated (and presumably populated with the current value/key) because the View Accessor RowSet is only accessible via the RowImpl. If after the query has executed, I apply the bind variable value, re-execute the RowSet query, I can see that it's populated, and I can create a RowSetIterator to loop through the LOV RowSet and confirm that the key/value is there. I can even setCurrentRow on the RowSet but I still find that the above error appears in the serve log output seemingly after all this code executes.
    So my question is what is the technique for supplying bind variables to attribute LOV View Accessors as part of an underlying EO object query.
    In the run-time, the list items appear unpopulated (current value and list items). If I reload the page, it all comes up fine, which could tend to suggest that a PPR event might fix me up, but I would prefer to know how this should be done.
    Thanks in advance.
    Edited by: robli on Dec 9, 2009 9:01 PM

    Hi,
    Is your issue resolved. I'm facing similar issue. I have created a viewaAccessors in EO, associated these to ViewObject attributes as List of Values.
    I created the table in UI using the ViewObject.
    I see those as selectOneChoice but not values (Empty list).
    If I create new record in the table by CreateInsert. table now shows the ListOfvalues.
    any Idea what am I missing.
    Thanks,
    Satya
    Edited by: stammine on Mar 2, 2010 4:09 PM

  • Select item in list box using code

    We use Adobe Workflow v5. I am creating a Check Request application where users type information into various fields and when they click Add, the data is added to a List Box. Also when they click Add, if the current item is >$1,000, a query searches our accounting database to see if the client has outstanding AR older than 90 days. If they do, another list box is displayed with the client name and amount of outstanding AR.
    If that clientnum is already in the second list box, it does not add another one.
    To delete a record from the first list box, the users select the item in the first list box, and then click a Delete button. That deletes the
    record in the first list box.
    I am also trying to delete the record from the second list box but am not sure how to select it using code. As part of the Delete button code, if the currently selected item (the one they want to delete) is >$1,000, I go through each row of the first list box to see if clnum.text (field in the form where the record to be deleted is now displayed) matches the client number in column 4 of any row of the first list box. If it does, I see if the amount of the item in the first list box is >$1000.
    If it is, then I know that there is a corresponding record in the second list box.
    Here is some of the code:
    'go through each row in first list box
    For irow = 1 to lstExp.ListCount
    'set clientnum variable equal to client # in row in first list box
    clientnum = lstExp.RetrieveItem(irow,4)
    'if clientnum variable is equal to client # to be deleted from first list box (selected record - client # in clnum.text now)
    if clientnum = trim(clnum.text) then
    'if amt is >$1,000 in first list box
    if lstExp.RetrieveItem(irow,10) > 1000 then
    'don't delete row because there is another record in first list box
    DeleteOutAR = "N"
    else
    'delete row because there is NOT another record in first list box.
    DeleteOutAR = "Y"
    end if
    end if
    Next
    Here is the code I need help with. I am unsure how to select the record in the second list box so I can delete it.
    if DeleteOutAR = "Y" then
    'go to second list box ?
    form.GoToField(lstOutARUnbilled)
    'start going through second list box looking for clientnum
    For irow2 = 1 to lstOutARUnbilled.ListCount
    if clientnum = lstOutARUnbilled.RetrieveItem(irow2,1) then
    irow2 = lstOutARUnbilled.CurrentSelection
    lstOutARUnbilled.Removeitem (irow2)
    end if
    next
    end if
    So my question is, how can I move to the second list box to actually delete the record?
    Thank you in advance for any help.
    Mary

    Mary-
    The solution could either be quite easy or difficult dependent upon how the data is arranged in the subsequent list box.
    Basically, if there is any sort of corresponding or matching entries, meaning line 1 from list box #1 matches with line 1 of listbox #2, then you would simply execute the following...
    "listbox#2.RemoveItem listbox#1.CurrentSelection"
    Or if you have a column that would contain the same values, say an index, then you could just loop thru the 2nd listbox searching for that index and once found remove the line...
    "listbox#2.RemoveItem nRow"
    , where nRow would be the line that you discovered to have the matching index.

  • Tree Control Highlighti​ng Programmat​ically Selected Item

    Does anyone know whether it is possible to highlight a programmatically selected item in the LV Tree Control, eg I have used the "Get Child" method to select an item - how do I then highlight this item on the tree?

    Yes, you can write the value to a local variable for the tree control. This will have the effect of selecting the item--which will highlight just ike the user clicked on it.
    By the way, "Get Child" doesn't select an item in any sort of useful sense--it just tells you what the child is. Actually, it tells you what the first child under the indicated Parent is.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Using checkboxes to select items in a Spark DataGroup/List?

    I have a DataGroup from Catalyst, laid out like a tile list:
    I'd like to do something a bit different, in that I'd like to allow people to multi-select items in the list using those checkboxes instead of the usual command/control-click.
    The checkbox, label and image are in the itemRenderer.  Is there an easy way that I can have that checkbox toggle the selected state of its list item?

    Hi,
    Using the checkbox as a selection is easy enough as all you have to do is add a change event to the checkbox in the renderer and then in the event
    selected=mycheckbox.selected;
    The fun is how to handle the list click event from the checkbox you can stop propagation but if the item is clicked it will reset the selected indices.
    There is a few ways to handle this
    when processing the list don't use the selected indices just use the checkbox value to determine whats selected
    disable the listbox click event so items have to be selected with the checkbox
    or the most complex lots of overriding so that click acts like a ctrl/click and the checkbox/itemclick can toggle each other.
    David

  • Combox Box not displaying selected item

    Below is the code I'm using to try to capture and display the
    selected item from a ComboBox:
    private function
    changeProjectTypeSelection(event:Event):void{
    projectTypeChange.text+=event.currentTarget.selectedItem.cboProjectType
    + " " +
    event.currentTarget.selectedIndex + "\n";
    Then the ComboBox:
    <mx:ComboBox fontSize="12" x="93" y="83" width="110"
    id="cboProjectType" dataProvider="{projectTypeArray}"
    labelField="projectTypeName" selectedIndex="0"
    click="changeProjectTypeSelection(event)"></mx:ComboBox>
    Then the TextInput:
    <mx:TextInput id="projectTypeChange" x="248.95" y="84"
    width="121"/>
    I know there's something wrong with the Actionscript code...
    just haven't figured it out. Any suggestions would be greatly
    appreciated!

    I've almost got it...
    private function
    changeProjectTypeSelection(event:Event):void{
    var i:int;
    for(i=0;i<projectTypeArray.length;i++){
    if(projectTypeArray.getItemAt(i).projectTypeName ==
    event.currentTarget.selectedItem.projectTypeName){
    projectTypeChange.text+=projectTypeArray.getItemAt(i).projectTypeName
    + "\n";
    Alert.show(projectTypeArray.getItemAt(i).projectTypeName +
    "FirstAlert");
    //Alert.show(event.currentTarget.selectedItem.projectTypeName +
    "SecondAlert");
    I just can't seem to be able to reset the value in the
    textInput field. I've tried setting it equal to spaces in several
    places, but it won't change after the first selection. Any ideas?
    Thanks for any suggestions!

  • Getting selected item from combobox itemrenderer and storing in object

    Hi Guys,
    Can anyone help me in this regard. Its very urgent.
    I have a combo box itemrenderer in datagrid column. I want to get the user selected item from the dropdown of the row(s) (User may select values from combo box from multiple rows of datagrid) and corressponding values of all other columns of the rows and store it in an object . Then pass this object to database to update only those rows that user has changed.
    I am able to get the selected item from combo box using "event.currentTarget.selectedItem" and corressponding values of all other columns of the rows using "valueSelect.ID", etc where valueSelect is object which contains data for datagrid. But am stuck up with, how to store the selected item value of the combobox  and corressponding values of all other columns of the rows into an Object ?.
    Can anybody help me with sample to store selected item from combobox and its corressponding values of all other columns into an object which i can send to db...?
    Kindly help me in this regard.
    Thanks,
    Anand.

    Hi!
    Are you using a collection of VO or DTO as the dataprovider of the combobox component?
    If so, have you created some attribute there to control the user's selection in the combobox?
    For instance:
    private var selected:Boolean = false;
    If your solution fits this approach, you may create a new collection that contains just the objects that were selected by the user, it means you can loop through the datagrid's dataprovider and only insert in this new collection those objects that have the attribute "selected" set to true.
    For instance:
    private function getSelectedRecords(datagridDataProvider:ArrayCollection):ArrayCollection
        var newCollection:ArrayCollection = new ArrayCollection();
        for each (var item:Object in datagridDataProvider)
            if (item.selected)
                newCollection.addItem(item)
        return newCollection;
    Afterwards, you may serialize this new collection with your back-end.
    Hope it helps you!
    Cheers,
    @Pablo_Souza

  • Get Selected Items from ListBox

    Hi,
    How do I get the Selected items of a List in Flex.
    I am using a multi-select List.
    Thx

    Never mind..I got it.
    it as simple as that:
    Alert.show (lst.selectedItem.fieldname);
    ;)

  • Removing selected items from listbox

    Hi ADF Experts,
    I have a selectmanylistbox with few values displaying in UI and a Remove Button at the bottom.
    User selects certain items from the listbox and clicks on Remove button. The selected items should be reomved. Can anybody suggest how to do this.
    Thanks,
    Animesh

    Duplicate of https://forums.oracle.com/thread/2562542
    User, please don't ask the same question multiple times. If you don't get the answer you want it may be because you did not give the right information and or use case me understand.
    Timo

Maybe you are looking for

  • Oracle 8i and XML

    Having trouble with an installation of the XML parser on Oracle 8i, hoping someone here has seen this one before. The following error comes up each time the parser is called in PL/SQL: ORA-29540: class oracle/xml/parser/plsql/XMLParserCover does not

  • Mail 2.0.7 crashing on sending mail

    Hi all. I have three accounts in Mail; one IMAP, two pop. Every time I send a message Mail crashes. The messages go, but Mail gives me the beachball and hangs. I have MailTags and Mail ActOn installed, along with Growl, but they seem to be behaving c

  • PDF file being blocked by Firewall

    I have 3 PDF files our of thousands that are being blocked by my companies firewall. None of the others are being blocked.We have re-created these files on different machines, with different names and still noluck. Outside our firewall they can be do

  • I want to synchronize my iPOP with my new MAC. How can i do that without lost my applications and songs???

    I want to synchronize my iPOP with my new MAC. How can i do that without lost my applications and songs???

  • Nimax.exe - Application error

    Hi, I try to control my camera (Redlake, Megaplus) with Measurement & Automation. But, when I open Measurement & Automation I have an error 'NImax.exe - Application Error'. In attachment, a copy of the screen with the error. Do someone know how to re