Using cfloop to ignore repeated values - help

I have a query that joins two tables for a price comparison
site. the first table holds information about a product. the second
table holds store specific information about a product. so a
product in the first table is unique. In the second table the
product is repeated depending on how many stores stock the product.
When I go through CFoutput the product is being duplicated
which I want for certain screens but not others. I need a cfloop
that checks to see if a product title is repeated and if so, move
to the next product. without duplicating the product in cfoutput
any ideas???
thanks

Add ORDER BY product into your query then use the group
attribute in cfoutput to only display the products and not the
repeated details.
<cfquery... >
select ...
from ...
where...
ORDER BY product, ...
</cfquery>
To show only the products
<cfoutput group="product">
</cfoutput>
To show multiple records for each product
<cfoutput query="..." group="product">
<cfoutput>
</cfoutput>
</cfoutput>
OR
<cfoutput query="...">
<cfoutput>

Similar Messages

  • Use Album Artists causes repeat values of Various Artists

    The obvious implication of the new *Use Album Artist* feature in the Colum Browser is that only Album Artist values will be listed and further that each will be listed only once, sorted by the value of Album Artist or Sort Album Artist. It may be that the previous build (where the feature was introduced) did just this but I have noticed that the current build with Group Compilations turned off will, for example, list the value Various Artists at multiple locations in the Artist column in the browser.
    For example, say we have a playlist with albums by Alice, Charlie, Eric & Grace together with a compilation featuring artists Bob, Dave & Fiona with an album artist value of "Various Arists".
    With *Use Album Artists* turned on and *Group Compilations* turned off I would expect I would expect the artist panel in the column browser to read:
    Alice
    Charlie
    Eric
    Grace
    Various Artists
    but what we actualy get is:
    Alice
    Various Artists
    Charlie
    Various Artists
    Eric
    Various Artists
    Grace
    In other words each different value used for Album Artist with compilations, Various Artist, Original Cast, etc. may be listed multiple times at multiple locations within the Artist column instead of just once as expected.
    So, is it just me? Anybody still on 9.1.0.79 or a Mac build care to confirm if they see the same?
    tt2

    Compilations need a value for album artist to keep them connected on an iPhone as I've noted elsewhere. However exploring the problem further it isn't even about compilations & various artists, it was just working with them that brought it to my attention. A more accurate description of the problem is:
    With the new *Use Album Artists* feature turned on the artist pane fails to re-sort when you change the value of Album Artist or Sort Album Artist and does not update until you close and re-open iTunes.
    E.g. Change "Albert King" to "King, Albert" in either Album Artist, Sort Album Artist or both and the entry in the Artists pane will stay put under A. Close iTunes and re-open and it will have moved to K.
    I have already sent feedback with a link to this thread. Again it would be useful if any Mac or Win 9.1.0.79 users could confirm if they see the same behaviour.
    tt2

  • Visual Composer 7.0.1 (EHP1) - Value Help only shows "Single Selection"

    I tried to add a value help to a field that allows multiple selections. However, when I used the wizard through "Add Value Help" drop-down menu, I can only see one proposed selection -  "Single selection". However this SAP help document (http://help.sap.com/saphelp_nw70/helpdata/en/b5/036d391f074f769e00602634ee9960/content.htm) mentioned about the "Multiple selection" option. What I can do to make this selection available?
    I am using VC 7.0.1 (EHP1). Thanks for any helps in advance.
    Kelly

    Hi
    Are you using 'BI Query' as 'data Service'? & are you creating value help for variable? If Yes -
    Create necessary variable as 'Multiple Single Options' in your BEx query & then create value help in VC. Then it will allow multiple options or interval values.
    Regards
    Sandeep

  • SVS, EVS, and OVS, Value Help and Search Help

    what and how to use SVS, EVS, and OVS, Value Help and Search Help  in abap webdynpro...Can anyone please give example link or document...As i am able to get on ovs but unable to get rest of other

    SVS and EVS are Web Dynpro Java specific types of value help.  They do not exist in Web Dynpro ABAP.  In Web Dynpro ABAP we have Data Dictionary based Search Help, OVS, and Freely Programmed Value Help.  In WDA 7.02 we have the slight variant on DDic Search Help called Suggest Values.  It doesn't change the development model, just the runtime user experience. 
    You can read more about each of the types of WDA based value help in the online help:
    http://help.sap.com/saphelp_nw73ehp1/helpdata/en/47/9b298c66eb3376e10000000a421937/frameset.htm

  • How to use cfloop index value as part of another variable

    Hello,
    I have a RATE form that first asks "how many rates will you
    be adding?" that answer generates a series of form elements based
    on the answer. You then have a form grid to populate, 3 values for
    each rate (price, code, name).
    This part works fine. The issue is now I need to INSERT the
    values into the table, so I need to use the INDEX value of the
    cfloop to recreate the amount (and names) of the fields in the
    INSERT statement. How do I escape, or re-create the evaluated form
    elements ( in which their count is #i# as the loop goes) when I
    need to evaluate for #i# AND evaluate for #form.sku_i_name# at the
    same pass?
    I am passing, for example, #form.sku_2_Name# where that might
    equal "Half Page". The number 2 in that variable was assigned
    during the form creation by the current index of a cfloop. Since my
    action (insert) page does not know how many (out of 50 possible)
    sku's are coming, how do I use the skuCount (another hidden value
    passed as well) to create a proper INSERT SQL command when I need
    to eval the form element and the index at the same time?
    Obviously #sku_#i#_Name# does not work, and #sku_i_Name# does
    not either... I know this can be done, and that I am just doing it
    wrong.
    Thanks for any help!

    bigbrain28 wrote:
    > Thank You, cfsearching! I don't quite understand 100%
    how it works
    As all three of us indicated you use array notation for this
    type of
    requirement. In ColdFusion you can use array notation or dot
    notation
    to access structure data. Almost all data in ColdFusion is
    now some
    type of structure.
    I.E. #Form['myField']# is the same as #Form.myField#.
    The advantage is that with array notation you can do things
    you can not
    do with dot notation. You can reference elements that have
    keys that
    are illegal variable names such as one with a space.
    I.E. #url['my field'] is allowed, #url.my field# would fail
    or course.
    And you can concatenate the key string as we did with your
    example.
    I.E. #Form['aString' & aVariable]#
    There are many powerful things one can do with this
    knowledge. One can
    access record sets with array notations. This can allow for
    very
    sophisticated parsing of a record set.
    I.E. #myQuery['column'][row]#
    You can dynamical call a variable. Thus creating dynamic code
    that does
    not even need to know what variables exist until run time.
    I.E. #variables[anyName]#
    This just scratches the surface.

  • How do you use user defined error messages in Value Help?

    Hi,
    I'm currently working on a Modifiable Value Help Selector in Web Dynpro Java, and I want to use a user defined error message when I validate the values entered by a user. Currently, it's returning its default error message ("Character <string> does not match...").
    Since the project requires a different error message, is there a way to override the default error message and use my defined error message instead?
    Thanks!

    Hi Angelo,
    I am not sure why message area is showing both Custom and inbuilt messages but you can try the following:
    i guess you must be using reportContextAttribute exception for showing Error messages on the input fields as well.in that case you can disable the message area so messages will appear only on the Context level ie; on input fields.
    For other messages apart from validation messages you can enable the message area before reporting the exception.
    make sure the boolean context variable which will be used for enabling and disabling the message area should have Readonly property set as true.
    I am not sure whether this is the only solution for this but you can try and see if it works.
    Siddharth

  • Using Wildcards in Value Help

    Hi,
    I have a input filed ZPERNR and i have assigend PREMN search help on this field.
    I am able to search people in the organisation and it all works great until I use wildcards
    When I enter SMITH in the last name in the value help it comes back with the list of people whose last name is SMITH
    Problem:
    When I enter SMITH* in the last name I get no results
    In the SQL trace I noticed it changed my SMITH* to smith%
    Not sure if there is any sap note to this issue
    Any ideas?

    Hi Jörg,
    Yes the icon (Pattern) does appear after I enter, however I still don't get any results.
    The weird thing is the value help works perfectly alright in r/3
    Not sure why it is not working for me in the portal.
    Thanks for your reply
    Kal

  • Using S_RS_AUTH in VALUE HELP ?

    Hi, thanks for your time.
    I have problems with the use of the subject to S_RS_AUTH in BI 7.
    For example, my object is ZCOUNTRY_CL and used 0COUNTRY with the "CL".
    In the "Value Help" from Visual Composer displays all countries, while in BI7 shows only those countries that are within the authority.
    The idea that I can think of is to create a ZBAPI to call a Query that I return the country of approval, Using for this RSCRM_BAPI or something similar in BI 7.
    I would appreciate if you could indicate some other option to upload in the "Value Help" values of authority, or give me any suggestions to improve my idea.
    greetings

    You can look solution in post to blog the Judy until we make owner Blog.
    /people/judy.kestecher/blog/2008/08/26/whats-new-in-visual-composer--enhancement-package-1-for-sap-netweaver-70

  • Clear selection screen fields on using value help on another field

    Hi Experts,
    I have 3 fields -  reason1, reason2, reason3.
    Now i want to clear fields reason2 and reason 3 when i use value help for reason1.
    How do i go about it.
    Thanks & Regards
    Gaurav Kumar Raghav

    Hi,
    You use the function module 'DYNP_VALUES_UPDATE', here is a code extract showing its use..
    *&      Form  f4_laufd
    form f4_laufd .
      data: ls_laufk type ilaufk,
            lt_laufk type table of ilaufk.
      ls_laufk-laufk = space.
      ls_laufk-sign  = 'I'.
      append ls_laufk to lt_laufk.
      call function 'F4_ZAHLLAUF'
        exporting
          f1typ = 'D'
          f2nme = 'F110V-LAUFI'
        importing
          laufd = p_laufd
          laufi = p_laufi
        tables
          laufk = lt_laufk.
      perform set_selection using 'P_LAUFI' p_laufi.
    endform.                                                    " f4_laufd
    *&      Form  set_selection
    form set_selection  using    value(i_field)
                                 i_value.
      data: ls_dynpfld type dynpread,
            lt_dynpfld type table of dynpread.
      ls_dynpfld-fieldname  = i_field.
      ls_dynpfld-fieldvalue = i_value.
      append ls_dynpfld to lt_dynpfld.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname     = sy-repid
          dynumb     = sy-dynnr
        tables
          dynpfields = lt_dynpfld.
    endform.                    " set_selection
    Darren

  • Return each value only once using cfloop query

    Hi,
    I have some code that dynamically populates a cfselect list and then populates a second list based on those values. Everything seems to be working fine, except that all values are being pulled from the database, and there are duplicates in most cases. For example, value 1S1W diplays in the drop-down menu 10 times, where I would only like it there once.
    Is there a way to have one of each value in my list?
    <cfif isDefined('form.select_Main_Group')>
        <cfset page.select_Main_Group = form.select_Main_Group>
    </cfif>
    <cfoutput>
      <form name="DropDown" method="post">
      <!--- query DB for the first drop down list --->
    <CFQUERY name="get_Main_Group" datasource="ds" dbtype="odbc">
    SELECT *
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY page_description
    </CFQUERY>
      <!--- first drop down list --->
      <!--- NOTICE the onChange javascript event in the select tag, this is what submits the form after the first selection --->
      <select name="select_Main_Group" required="yes" onchange="this.form.submit()">
         <option>Select Township/Range</option>
         <!--- dynamically populate the first drop down list based on the get_Main_Group query --->
         <!--- NOTICE the CFIF within the option tag, this says, if the first selection has been made, display the chosen option when the page reloads --->
         <cfloop query="get_Main_Group">
             <option value="#SECTION#" <cfif isDefined('form.select_Main_Group')><cfif form.select_Main_Group eq "#SECTION#">selected</cfif></cfif>>#TOWNSHIP_RANGE#</option>
               </cfloop>
    </select>
    <p>
    <!--- if the first selection has been made, display the second drop down list with the appropriate results --->
    <cfif isDefined('page.select_Main_Group')>
       <!--- query DB for second drop down list, based on the selected item from the first list --->
       <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT TOWNSHIP_RANGE, SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE SECTION = '#page.select_Main_Group#'
       </cfquery>
       <!--- second drop down list --->
       <select name="select_Sub_Group" required="yes">
          <option>Select Section</option>
          <!--- dynamically populate the second drop down list based on the get_Sub_Group query --->
          <cfloop query="get_Sub_Group">
             <option value="#SECTION#">#SECTION#</option>
          </cfloop>
       </select>
    </cfif>
    </form>
    </cfoutput>

    Emily,
    OK.  Yes it is possible.  Change your first query to:
    SELECT  DISTINCT TOWNSHIP_RANGE
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY TOWNSHIP_RANGE
    </CFQUERY>
    Notice I removed any mention of SECTION, because it's irrelevant to generating a unique list of TOWNSHIP_RANGE.  Also, GROUP BY is not needed, but an ORDER BY will sort the records in alphanumeric order.
    Then you need to modify your code where you generate the option list for the first pulldown:
    <option value="#get_Main_Group.TOWNSHIP_RANGE#" <cfif StrucKeyExists(form,'select_Main_Group') AND form.select_Main_Group eq "#get_Main_Group.TOWNSHIP_RANGE#">selected</cfif>>#get_Main_Group.TOWNSHIP_RANGE#</option>
    Here I did a couple of things beside changing SECTION references to TOWNSHIP_RANGE .  It's a good idea to add the query name prefix to column names when you output them so that you avoid collisions with variables that have the same name.  I also reduced your <CFIF> statements to one compound statement for simplicity, and replaced the IsDefined with a StructKeyExists function.  This is considered to be better practice and won't throw an error when used in a compound statement (if you kept the IsDefined statement and tried that in a compound selection, it can sometimes throw errors if the variable in the IsDefined doesn't exist).
    Now, your second query should be something like:
    <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT DISTINCT SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE TOWNSHIP_RANGE = '#page.select_Main_Group#'
            ORDER BY SECTION
       </cfquery>
    Here I changed the WHERE clause to filter based on the TOWNSHIP_RANGE you selected in the first pull-down.  This should now return a list of SECTIONs that match the TOWNSHIP_RANGE selected in the first pull-down.
    Lastly, some minor changes to the option list for the second pulldown:
      <option value="#get_Sub_Group.SECTION#">#get_Sub_Group.SECTION#</option>
    One other thing I noticed.  If you are on ColdFusion 8 or 9, the dbytpe="odbc" is no longer needed.  I'm assuming you are using an ODBC database connection to something like MS Access.  If so, you can omit the dbytype entirely.  It's only needed now if you do query-of-query queries, where it would be dbtype="query".
    HTH,
    -Carl V.

  • Value helps in UI(Dynpro) from MDM using webservice

    Hi,
    I have a UI developed in Webdynpro which takes value helps from MDM SP04. For the value helps i have a webservice which has the code, description and table name. Could anyone help me out on what to do after importing the websevice model..
    thanks.

    return arraylist from web service and poarse in side webdynpro

  • Sql sript for Insert of data with repeating values

    It has been a long long time since I had to do write and use any SQL scripts, please forgive the question. I used to use a script to insert values into a table as part of my job. I have forgotten what the script I used was and since lost all my Oracle note books and other DBA material.
    I did a search and went through 30 pages of results, I didn't see what I'm looking for.
    The data is from one large file that is appended at the end and sometimes updated somewhere in the middle of the set which is considered new data. I am not concern with getting the data out of the file, I got that handled but the insert into the table - transactions - is where I'm lost.
    I used to use a script to load the data, about 6 years ago, and it would load the file, exclude the data that was already in the table and insert the new data and the data with the changes.
    The data columns are date, time, reference, transaction code, location, debit amount, fee amount, balance.
    The date repeats but the time and reference values are unique.
    Any help with this script is appreciated.

    Hi,
    welcome to the forum..!
    You can use Oracle's merge statement to (update + insert) data into a table ... if the data exists update it with the new values and if it does not, then insert it.
    Here's a link to get you started...
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm
    Since, the data is from a file, you could create an external table on the file and directly do a select from the file.
    MERGE INTO bonuses D
       USING (SELECT employee_id, salary, department_id FROM employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
         DELETE WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
         VALUES (S.employee_id, S.salary*0.1)
         WHERE (S.salary <= 8000);in the above example, the
    SELECT employee_id, salary, department_id FROM employeesis the source data. instead of loading the file into a temporary table and then merge into the target table , you could read from <<<external_table_on_your_file>> and then do a merge into the target table.
    http://www.oracle.com/technology/products/oracle9i/daily/sept19.html
    If you encounter any problems, please post the full description of your error.
    Thanks,
    Rajesh.
    Please mark this/any other answer as helpful or answered if it is so. If not, provide additional details/feedback.
    Always try to provide create table and insert statements to help the forum members help you better.

  • Web Report - Hide Repeated Values

    My web report hides repeated values regardless of the query setting. 
    Is there any way to set a specific column to not hide repeated values?  Using the table API?
    Thanks!

    dear Kenneth,
    have you try to remove the check mark of properties 'suppress repeated text' in 'specific' section of your web item 'table' in web template ?
    or you can give parameter SUPPRESS_REPETITION_TEXTS for web item 'table' with value blank
    <param name='SUPPRESS_REPETITION_TEXTS' value=' '>
    doc may useful
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/13dc9190-0201-0010-71a4-a9f56cdfcc72
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b1089290-0201-0010-288c-98e4d26487ee
    hope this helps.

  • Repost: Use Page-scope expressions in Value expressions

    Dear Adam Winer and expert group,
    I woud like to repost my problem. I had posted this in an earlier thread today. The issue that I would
    like to raise is regarding being able to use page-scoped beans in value expressions. I am trying to
    port some screens from Struts to JSF. Struts allows you to assign page-scoped beans to its input
    components. Adam Winer, you have been very helpful to me. I hope this issue can be solved.
    Thanks,
    Ajay
    Dear Adam Winer,
    I must admit that I am not able to understand your post properly. It is certainly because I have not
    properly understood the JSF architecture properly as yet.
    JSF automatically shows model bean values in the browser, and takes user input back into the model bean.
    But it would be nice to have the following scenario to work out....
    1. The JSP assigns the (initial) value to the JSF component.
    2. This value is displayed in the browser.
    3. When the user submits the form, the value goes to the model bean.
    Your post seems to indicate that the above is not possible. Could there not be any architectural
    workaround to make this possible ?
    Your post also seems to indicate that it is not possible to use an action from within a <c:forEach>.
    The following could also be perhaps ok (if it doesnt cause some other problem).
    <h:input_text initValue="#{pageScopeBean.someValue}" value="#{someBean.someValue}"><f:parameter initValue="#{status.count}" value="#{DataTable.selectedIndex}" />
    Perhaps, the expert team can come up with some brilliant solution. I am really keen.
    Ajay
    P.S ("Delayed execution", "Immediate execution", "does not exist on subsequent requests" are presently
    Greek and Latin to me.)
    No, that's not really possible, and it's not because
    we didn't try!
    "#{}" syntax means "evaluate this later". It has to
    mean that, for lots of reasons, including the need to
    evaluate these values on subsequent requests, and to
    evaluate these values repeatedly when a repeater
    component (like data_table) renders its output.
    Obviously, pageScope.status.count won't exist on
    subsequent requests, so that bit is hopeless. But it
    won't necessarily even work in the middle of the page,
    because there's no guarantee that the value of that
    <f:parameter> will only be used during the execution
    of <c:forEach>.
    We'd considered adding support for both delayed
    execution - "#{}" - and immediate execution - "${}" on
    JSF attributes, which would enable an example like
    this, but decided not to, for two reasons. First, it
    would be very confusing. Second, it actually opened a
    small security hole to do so that can't be solved
    without changes to the JSP EL architecture.
    -- Adam Winer (EG member)

    Dear Adam Winer,
    I read your post again and understood what you mean by "delayed execution" and "immediate execution".
    I am sorry, I think I read your post too quickly and hence didnt compherehend it.
    Please let me know if you think an alternative syntax such as
    <h:input_text initValue="#{pageScopeBean.someValue}" value="#{myBean.someValue}"/>Perhaps, this is not so different from the "#{}" and "${}" syntax that was discussed in the expert group.
    I am trying to imagine why a security loop-hole could be caused. If Struts doesnt have any problem
    getting values from a page-scoped bean, why does JSF have the problem ?
    Thanks for your help.
    Ajay
    We'd considered adding support for both delayed
    execution - "#{}" - and immediate execution - "${}" on
    JSF attributes, which would enable an example like
    this, but decided not to, for two reasons. First, it
    would be very confusing. Second, it actually opened a
    small security hole to do so that can't be solved
    without changes to the JSP EL architecture.

  • Initialising F4-Value-Help for date

    I want the F4-Help for a date field to show a month different from the current one.
    By default the month containing sy-datum is displayed.
    I want the popup to start in another month.
    I tried already to create a search help and setting the startdate in a function module of it's group.
    This worked in SAPGui, but did not in Web Dynpro.
    Does anybody have an idea, how to implement this.
    Thanks in advance
    Bernhard

    You would have to create Freely Programmed Value Help and within the layout of the Value Help create your own Data Picker using the DataNavigator UI element. With the Freely Programmed Value Help approach, you can ignore the current value in the bound context and start with any values you want.  The downside will be that it won't be quite a user friendly.  Instead of the quick calendar pop in place, you will get the full value help popup window.

Maybe you are looking for

  • Oracle 11g r2 installation 2008

    Hi Frens I want to know is oracle 11g r2 stable on windows 2008???aur what problems does it face???please telll me as i need to know this urgently... Thanks in Advance

  • Computer responding very slowly

    I purchased my iMac G5 about 3 years ago but I'm not very computer saavy - sorry. It used to respond quickly (the internet, itunes, iphoto, etc.). Over time I feel that my computer has gotten slower. I seems that I am wait longer and longer for it to

  • Removing Columns in Web Reports

    Hello Experts, I would like to remove a column in a We report. I would like to remove the first column in a web report it should be this way by default. Is there any way to do this. Please do help me out....

  • IPhoto 9.2/9.2.1 pin locations in Places don't 'stick'

    I've been having an issue with iPhoto since 9.2. I have some photos that aren't in the correct location in Places, so I move the pin to where it should be. Problem is, when I go from that picture to another and then back to the original picture, the

  • Apps on both windows 7 pro & XP Pro through paralells 5.0

    I have 2 virtual machines running on my macbook pro, windows 7 pro & windows xp pro. I installed the full retail version of windows 7 pro first, & now recently installed windows xp pro service pack 2 OEM. I also have some windows apps installed on bo