IEnumerable T Property as parameter in Lambda Expression

Hi,
I have following construction which returns selected items from the list:
public IEnumerable<Country> SelectedProducts
get
return this.Countries.Where(c => c.ContinentName.Equals("Product Catalog") && c.IsSelected);
}The following construction foreach (Country c in SelectedProducts)
MessageBox.Show(c.ProductName.ToString());
returns product names for selected products in list. How can I use SelectedProducts and pass the same into lambda expression to retrieve data from database. Since it contains multiple values it should be used something like with IN expression in T-SQL
or not. Please help in order to get this working.
Thanks in advance.
Almir

Hello Barry,
I converted Selectedproducts
 public
IEnumerable<Country>
SelectedProducts
            get
return this.Countries.Where(c
=> c.ContinentName.Equals("Product
Catalog") && c.IsSelected); 
to string[] array using construct SelectedProductsToString and then pass it to where clause as it is shown in ShowSelected() method.
private string[] SelectedProductsToString
get
return SelectedProducts.Select(c => c.ProductName.ToString()).ToArray();
public void ShowSelected()
var result = Fact.Where(c=> SelectedProductsToString.Contains(c.ProductName));
Do you think it's ok from your point of view or should consider something else.
Thanks for your opinion.
Regards.
Almir

Similar Messages

  • IView Property: application parameter

    Hello,
    I have a question regarding the iView property "application parameter": how can I set several application parameters?
    For example: first parameter useractionid=UAUSER; second parameter application=V01 - how can I seperate these parameters? with blank, with comma and blank or only comma, semicolon and blank or only semicolon, or anything else?
    Thanks
    Steffi Gründemann

    Hi Steffi,
    In the application URL, you can add the required parameters. First parameter followed by '?' question mark then '&' (only AND symbol). See the example below:
    http://host:port/testApplication?useractionid=UAUSER&application=V01
    Regards,
    Satya
    [Pls reward points if helpful]

  • Lambda expressions and compiler extensions

    Hi guys,
    I'm working on a project that is designed to play nicely with closures (anonymous functions) and it would be really nice if lambda expressions were supported due to the abbreviated syntax.
    I posted a question on these forums last year and the reply mentions a "custom asc extension". Is the compiler (even if it's just 4.0) extensable in a way that support for lambda expressions could be added? If it's not *that* extensible, how much effort would be involved?
    If it's simply not possible, can I make a language request for the next release?
    Cheers,
    Richard
    PS. FYI, here are the requirements for a lambda expressions as they would work in the AVM:
    "x:int => x + 1" is equivalent to "function (x:int) : int { return x+1; }"
    "(x:int) => methodThatReturnsVoid(x)" is equivalent to "function (x:int) : void { methodThatReturnsVoid(x); }"
    "() => 5" is equivalent to "function () : int { return 5; }"
    "_ => 5" is equivalent to "function (_ : Object) : int { return thereIsAnArgumentButIWontUseIt(); }"
    "() =>
        bracesMeansICanUseMultipleStatements();
        return butIHaveToUseReturn();
    is equivalent to
    "function():void
        bracesMeansICanUseMultipleStatements();
        return butIHaveToUseReturn();
    ... etc

    I think you misunderstood my post. I was asking for a pointer in the right direction to implement the support myself, and how the extension would integrate into an existing sdk installation.
    I realise that AS3 is not intended to match C# feature-for-feature, but I've been working on a port of Rx and lambda-syntax for anonymous functions would be much more pleasing on the eye.
    Besides, if I were set on requesting a feature, it'd be proper generics support!

  • Dynamic input parameter in EL Expression

    Hi all,
    In the Content Template for Content Presenter, I using a <af:image to show one image from UCM like that
         <af:image styleClass="nav-news-hot_item_img"
                            inlineStyle="width:94px;height:64px;"                      
                            source="#{documentsService.latestReleasedVersionURL['UCMServer56#dDocName:W7U64001001']}"/>Now I want replace specific parameter "W7U64001001" by a dynamic parameter. That mean the <af:image will show on a image corresponding the value put into this dynamic parameter
    Do you have any suggestion for me?
    Thanks a lot!
    Edited by: AS84 on Jul 2, 2012 1:29 AM
    Edited by: AS84 on Jul 2, 2012 2:40 AM

    Hi Daniel Merchán,
    I have just tried as your suggestion and it was still fail. In my opinion, with my issue we can do it because
           #{documentsService.latestReleasedVersionURL['UCMServer56#dDocName:W7U64001001']}not allow other EL expression between "[]". But it's only my own idea after a lot of trying.
    If you can try, maybe you will find out something different with my result.
    Thanks again!

  • Putting Parameter into SQL Expression or convert to formula Basic or Crystal

    Post Author: yoschua
    CA Forum: Formula
    Hello,In my old report I got something like thisSELECT MIN(cast("ParDyn"."ParVal" as integer))FROM "result".ParDyn WHERE "ParDyn"."ParNo" = (SELECT Max("Piece"."ParDynNo")                          FROM "result"."Piece"                           WHERE "Piece"."RequestNo" = XPARAM1 And "Piece"."PieceNo" = XPARAM2)      And "ParDyn"."ParIdent" = 'Trace.Assignment'  This report are viewed from VB component - at old VB they read SQL from report, input XPARAM1 and XPARAM2 and put it into report again and the show report.Because now I want to make my aplication I convert this report to use it not only at this old aplication, but with CR Viewer too.I see I can not insert Parameter into SQL Statement, so I need to use Basic or Crystal Formula.I try to make something like this : minimum({ParDyn.ParVal})and {ParDyn.ParNo} = 0of cource zero should be exchange with next statement, but this not working.What I would like to get is only one record, I do not want get whale table into CR engine and then evaluate becouse this report must work on slow connection, so I need take from database only records witch I need. Can someone help me, or show how to insert into formula value as parameter taked from another table dynamicly ?? Best Regards Bartłomiej Jóźwiak 

    Ok,
    The only way I found to get the maximum status date of an employee with the date entered in parameter was to litteraly put each employee ID, and Status Date in the Detail section.
    Then in the select expert create the parameter date.
    Then I created a running total field that counts the employees and resets on change of employee sorted by status date.
    Then I created a formula that gets all the first occurences of this running total field and if the running total field equals 1, a new formula field shows 1 and if not (2 and more), it shows 0.
    But I can't find the way to give me the total that I need for each group sections.
    It's ok if the SQL expression field does not work, but I need to find a way to get the max date.
    Thank's for your help for the SQL Expression field.
    Steph

  • KeyExpansion with SysType Property as parameter

    Hello,
    is it possible to get the parameter for a KeyExpansion out of the properties of the sender system?
    Example code:
    <?xml version="1.0" encoding="UTF-8"?>
    <BIU xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:com.sap.b1i.sim:entity"
         xsi:schemaLocation="urn:com.sap.b1i.sim:entity ../../com.sap.b1i.system.sld.repository/General.xsd/SemanticIntegrationModel.xsd"
         SenderSysTypeId="B1.2007" ReceiverSysTypeId="B1.2007" SenderCountryCode="*" ReceiverCountryCode="*"
         SenderMainObjectTypeId="B1.2007_BP" ReceiverMainObjectTypeId="B1.2007_BP" MainBizflow="Main.bfd" Name="Z.KeyExpTest">
         <KeyExpansionRule side="S">
              <TargetObjectType ObjectNameSpace="xmlns=&apos;urn:sap-com:document:sap:rfc:functions&apos;"
                   ObjectTypeId="Retrieval01" RequestGenerationRuleLink="/sim.com.sap.b1i.datasync.001/biu.Z.KeyExpTest/KeyExpansionB1.xsl">
                   <ObjectKeyList>
                        <ObjectKey FieldName="Key01"
                             SelectionPath="/b1im:B1IMessage/b1im:Header/b1im:System/sim:PropertyList/sim:Property[@Key=&apos;Subsidiary Identifier&apos;][1]/@Value"/>
                   </ObjectKeyList>
              </TargetObjectType>
         </KeyExpansionRule>
         <PropertyList/>
    </BIU>
    This test does not work. It seems only possible to use something like //BOM/BO/... for the ObjectKey SelectionPath.
    I need the value of the sender system property for my sql statement. Does anyone have an idea how I can achieve this?
    Kind regards,
    Marcus

    Hi Marcus,
    There is debug tool named SIM Process since B1i SN 2007 PL08, giving you an comprehensive process follow step by step.
    To enable the step process recording:
    1.Goto <<C:\Program Files\SAP\SAP Business One Integration\B1iServer\tomcat\webapps\B1iXcellerator\xcellerator.cfg>>
    Set bpc.maxDumpSize=-1
    # Sets the max. size to dump the payload-data on the CONFIG logging level.
    # A value of '-1' states that there is no constraint, a value of '0' switches the
    # dumping entirely off (the default) and a positive value is the upper bound in kBytes
    # to constrain the dump to.
    bpc.maxDumpSize=-1
    save the config and restart B1i Service.
    2.To swith on the recording for your system.
    http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1ip.system.cc/bfd/AdminConsole.bfd?!
    defdoc=/com.sap.b1i.datasync.b1isntools/ui/B1iSNTools.xml
    =>Run time tool=>IPO Control=>Choose your sender system id=>Click LogOn (switch on)
    3.Per sender key expansion, operate B1 to create the target event,
    B1iSN Tools=>Run time tool=>SIM Process Flow=>Choose your B1 sender system id =>Click PL02
    please take a look at P02 step (B1 Inbound), and check whether the new property is there.
    Also please refer to the following guide for operation
    http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1ip.system.cc/bfd/AdminConsole.bfd?!
    defdoc=/com.sap.b1i.datasync.b1isntools/ui/B1iSNTools.xml
    Tab Guide=>05. Operation => 2.2 B1iSN Processing (Page 8)
    Kind Regards, yatsea

  • Pass function name as parameter in SSRS expression

    I have a function (GetColumnFieldName) which returns string datatype
    Now I want to use this function in below SSRS expression
    =Code.GetDisplay("FirstName",Parameters!SelectedCols.Value,Parameters!DisplayCols.Value)
    At the above expression I want to replace "FirstName" with  function GetColumnFieldName which returns the same "FirstName".
    Please suggest.

    Hi Jajatibabu,
    If I understand correctly, you want to use GetColumnFieldName function which returns a field name to replace the “FirstName” in the expression you post.
    If in this scenario, we can directly use Code.GetColumnFieldName(parameters) to replace the “FirstName” like below:
    =Code.GetDisplay(Code.GetColumnFieldName(parameters),Parameters!SelectedCols.Value,Parameters!DisplayCols.Value)
    Note that we should type the correct parameters in the GetColumnFieldName function.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • How to pass column header as a parameter in Validation Expression (APEX4.0)

    Hello
    I created a new Page validation in APEX4.0 ( not 4.1 ).
    (1) Type : Function Returning error text
    (2) Validation Expression 1 :
    begin
    return validate_name ( p_c=> #COLUMN_HEADER# ,p_c_value=> to_date(:p26_LEAVE_FROM,'dd/mm/yyyy') );
    end;
    note: the validate_name is an oracle pl/sql procedure which takes two input parameters ( column header name and actual value ) and return a specific error message ( to that column ) or NULL.
    (3) In the Error Message section, I left Error Message blank ( as the app ignored the mssage but used the one returned from the above function)
    However, I chose "The Error display location" to be inline with field and notification" and Associated Item to be "p26_LEAVE_FROM".
    My question, it worked if I hard coded the actual column header "LEAVE FROM" , but it didn't work if I used the above #COLUMN_HEADER# in Validation Expression. Can I avoid hard coding as the column header might be changed one day. Is there a better way to deal with multiple column validations with different error message for each column ? It seems that I will have to create similar page valiation for each column to be validated.
    Thanks for your advice.
    Edited by: Susanna on 19/01/2012 17:45

    You want something like this:
    DECLARE
      lio_success  VARCHAR2( 2000 );
      li_id        NUMBER;
      li_dep_id    NUMBER;
      li_sel_id := NUMBER;
      li_date DATE;
      lo_date DATE;
      lio_return_message xyz_bpe_rec_fn.xyz_bpe_rec_col;
      l_ret xyz;
    BEGIN
      lio_success := 'some value';
      li_id := NULL;     -- or some number
      li_dep_id := NULL; -- or some number
      li_sel_id := NULL; -- or some number
      li_date DATE := sysdate;
      lio_return_message.col1 := somevalue;
      lio_return_message.col2 := somevalue;
      lio_return_message.coln := somevalue;
      l_ret := get_xyz( lio_success
                      , li_id
                      , li_dep_id
                      , li_sel_id
                      , li_date
                      , lo_date
                      , lio_return_message );
    END;
    /

  • Pass iView property as parameter to JSP in PAR file.

    Hi All,
    I have a custom created PAR file in which there is a JSP page there is a variable which I need to provide to users as a configurable property of the iView. So that when a user configures a value to that defined property to the iView, my JSP from the PAR should automatically pick this value and carry on the processing further as required.
    I have done some research on my behalf, which even though turned out just half of the solution, but still even then the code does not seem to work. For reference, please see link below:
    [Reference Document|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/508baf88-9335-2d10-efa6-c6ad61e5fc4b?QuickLink=index&overridelayout=true]
    I need this with very critical urgency, please, kindly help.
    Thanks and Regards,
    Abhishek Goel.

    Hi Prashant,
    I am sincerely thankful for all your efforts so far, but I still have a little problem with which I am stuck and somehow I think I am doing something terribly wrong.
    Just to test, I have included a button on the JSP page and on the click event of that button I have written my code in javascript as below:
    IPortalComponentRequest  currentRequest   = (IPortalComponentRequest)pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST);
    IPortalComponentContext  componentContext = currentRequest.getComponentContext();
    IPortalComponentProfile  profile          = componentContext.getProfile();
    var xyzVal = profile.getProperty("xyz");
    But I am still not getting the desired value in the xyzVal variable. Please advise how to go about the code.
    Also i have tried writing this code in a Java Class file. Even after making the required imports I am getting am error in the statement as indicated below:
    IPortalComponentRequest  currentRequest   = (IPortalComponentRequest)pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST);
    Thanks,
    Abhishek Goel.

  • Access property of a subcomp through expressions.

    I got a main composition. It got a subcomposition and a null-object(with a control checkbox).
    How can I access a layers opacity in the subcomposition throught an expression in the main composition?
    The goal would be to reuse the subcomp. Once with a layer visible and another time without.
    So far I wrote this in the control checkbox:
    if(value == 1)
    comp("subcomp").layer("xy").opacity =100 ;
    else
    comp("subcomp").layer("xy").opacity =0 ;
    I tried also to write an expression directly in the going to be hidden layers opacity:
    var control  = comp("maincomp").layer("control");
    100*control.effect(1).param("SliderControl").valueAtTime(control.time);
    This actually worked when I toggled the control checkbox manually, but as soon I keyed it, it didnt work anymore.
    It was kind of a time conversion problem: It takes the time of the parent but applies it to the subcomp……
    Thanks for help

    Thanks for the inputs.
    Unfortunatly there is still the issue about the timing.
    If I use ".value" I get the right value from the Slider from the parent but it will be executed based on the time of the parent comp. Which means the subcomp copies the time to its own "time-dimension".
    For example: If I have the checkbox control(in the maincomp) on 0 until frame10 and if I key it to 1 on frame11, the opacity of the layer(in the subcomp )is going to change on frame11 within the subcomp.
    If subcomp starts lets say on f5 in the maincomp the actual script would be executed on frame16 instead of 11. Therefore I need some additional techniques to let the magic happen when the checkbox-control is actually keyed. 
    100*control.effect(1).param("Checkbox").value
    The following pic should demonstrate it:
    a) Checkbox is keyed to 0 and should hide a layer in the subcomp at that time
    b) Currently the layers opacity is set to 0 here.

  • Anonymous Functions (Lambda expressions) in Java?

    Hello,
    I need to know if there are anonymous functions in Java. I am writing a platform independent shell, and I would like to use anonymous functions to make the shell better.
    Does Java support anonymous functions or is it unsupported?
    Thanks.

    functions without a name? no
    functions belong to classes, and every class method has a name.
    you want to use lisp.
    %

  • Can I make the parameter supports multiple selection and editable at the same time?

    Hi, 
    I am building my report using SQL Server Report builder 3.0. All the parameters are added to the report
    by the builder. When the user access the report by browser, he can change the parameter value and click "view report" button to load the report from the database.
    For one of the parameter, I want to provide user the ability to select frequently used value as multiple
    selection, and meanwhile let them able to edit the value if the preloaded selection doesn't contain what he wants.
    Is it possible to archive this goal using report builder?
    Thanks!

    You cant have this functionality using standard report viewer. An approximate work around can be implemented as follows.
    Have two parameters one based on your current parameter values (dropdown) and another one without any available values set and default set to NULL (Set Allow Null value property and pass Null as default value). This parameter will appear as disabled textbox
    with NULL checkbox checked. 
    Now in your code behind which gives you first parameter's values Add one more value say <None Of Values> and set value as some default value (-1 if int or just a random string value).
    Now in the value for second parameter set a expression like below
    =IIF(Parameters!FirstParam.Value ="<Select None>","",Nothing)
    This will make sure second parameter gets activated when you select option <none> from first. Then you can type the value you want in it
    In query behind just make filter like below
    WHERE field = CASE WHEN @Param1 <> '<None>' THEN @Param1 ELSE @Param2 END
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Ssrs 2008 r2 using parameter values

    In an existing ssrs 2008 r2 report, I have a requirement from a user where they want to add 2 more parameters to the report. Right now there is an option where the user can choice to generate report1, report2, report3, report4, report5, report6, report7,
    report8, and/or any combination of the reports I just listed.
    This is setup by using an expression in the visibility property for each of the 8 tablixes.
    For your information, the following is an example of how to display one of the reports or not:
    =iif(InStr(join(Parameters!report.Value,","),6)>0,false,true)
    Now the user wants to be able to add the parameters of customer and inventory_item based upon if report7 and/or or report8 is selected.
    Now can you tell me the following:
    1. Would you show me the code I can use in the dataset to select report7 and/or report8?   
     2. If the above is not possible to select specific reports, then would the dataset query need to look something like: where @report is null or where @report is not null? What would you suggest?

    Hi midnight_car,
    According to your description, you have specified visibility for each tablix in a report with IIF() function. When you select 7 or 8, you want to add an additional parameter to filter displayed tablixes, right?
    In Reporting Services, since we can’t specify the visibility of a parameter as an expression, we could add a cascading parameter. When the first value is 7 or 8, then selected values from the cascading parameter can filter the displayed tablixes. Please
    refer to steps below:
    1. Sample data.
    2. Create a new dataset with the query below:
    select distinct SalesTerritoryRegion as region from dbo.DimSalesTerritory
    where SalesTerritoryRegion=
    case when 3 in (@report)or 4 in (@report)
    then SalesTerritoryRegion
    else 'NA' end
    3. Specify the parameter @region using the new dataset.
    4. Query in main dataset like below:
    select SalesTerritoryRegion as region,SalesTerritoryCountry as country,SalesTerritoryGroup as [group] from dbo.DimSalesTerritory
    where SalesTerritoryRegion= case when 3 in (@report) or 4 in (@report)
    then @region
    else
    SalesTerritoryRegion end
    4. Preview the report.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Not able to set Property in bean

    this is my code-----------------------------------------------
    <% if (request.getParameterValues("Submit")!=null)
    %>
    <jsp:useBean id="WriteToFile1" class="mypackage.WriteToFile"/>
    <jsp:setProperty name="WriteToFile1"
    property="Path"
    value='<%= request.getParameter("Date") %>'/>
    <jsp:setProperty name="WriteToFile1"
    property="PageText"
    value='<%=request.getParameter("Diary") %>'/>
    <% WriteToFile1.WriteSomething();
    } //endif
    %>
    Sequence of code-
    1create an instance of WritToFile.claa
    2.get The Name of the File From a html Form entry "Date"
    3.Get The Data from Same From Entry "Diary"
    4.pass these values to class file and call the create and write method in the class file
    but i am getting this error
    " Cannot find any information on property 'Path' in a bean of type mypackage.WriteToFile' "
    Any help

    Does your writeToFile bean have methods getPath(), setPath()?
    Those are required to use the jsp:setProperty tag with them.
    Also rather than using a scriptlet expression, you can write your jsp:setProperty tag like this:
    <jsp:setProperty name="WriteToFile1" property="Path" parameter="Date">Check out the [url http://java.sun.com/products/jsp/syntax/1.2/syntaxref1216.html#8856] JSP Syntax reference  for details.

  • WebTest - VS2013 - Extract Regular Expression - Required=False

    I have an "Extract Regular Expression" that may or may not be able to extract a value. I set the property value of Required to False. The next block checks for the existence of that Context Parameter. If the Context Parameter is there, it does
    some work, if the Context Parameter is not there, it skips the condition.
    When I run my WebTest, it tells me that it passes the extraction rule but it never created the Context Parameter so the condition is skipped.
    If I set Required=True, everything works as expected.
    I remembered that there was a defect in VS2010 with the Required=False, so I added this Extraction Plug-In 
    [DisplayName("Extract Regular Expression Not Required")]
    [Description("Extract text matching a regex and add it to the test context. If no match is found, do not fail webtest. This gets around a VSTS bug where 'Required' property of the Extract Regular Expression rule is not honored.")]
    public class ExtractRegularExpressionNotRequired : ExtractRegularExpression
    public override void Extract(object sender, ExtractionEventArgs e)
    base.Extract(sender, e);
    e.Success = true;
    That too passes the regular expression but fails to create the Context Parameter.

    By setting the Required parameter to False, I am expecting that a Context Parameter does not get created if the regular expression is not found and that is does get created if the regular expression is found.
    So when I run my test, it tells me that the regular expression was found but my Context Parameter was not created. 
    When I created this webtest in VS2010, I found that there was a bug with the Extract Regular Expression when the Required property was False. This
    thread showed the code for a custom Extraction rule to fix the problem. When I run this webtest in VS2013, both the built-in Extract Regular Expression and the custom Extract Regular Expression Not Required are not creating the Context Parameter if the
    regex is found.
    Try this yourself:
    Create a webtest
    Add "Extract Regular Expression"
    Set the Regular expression to . (this will match any one character)
    Set the Requiredto False
    Set the Context Parameter Name to TEST
    Run the webtest
    Although the result from the extraction rule will be Passed, there is no Context Parameter TEST created. 
    If you create the custom Extract Regular Expression Not Required plugin, the same problem occurs.

Maybe you are looking for

  • Shortcuts in CS4 don't work

    why is it that when I use ctrl+a to select all it doesn't work. this happens when I open an image as copy using camera raw. thanks!

  • SOAP.request  URL issue

    Im using the below webservice script in my PDF, it is working fine. but, If the URL is wrong then the below code is not executing the remaining statement. If the URL is wrong or the server is down, I hav to show message, How should I catch that error

  • Different pricing procedure in delivery

    Dear All, In STO scenario we are sending material from mfg plant to Depots, Sales area defined for STO 1001,20,PP where till now we have used only one pricing procedure in Delivery(NL) & Billing (F8), but due to business requirement we want maintain

  • Want help in sockets

    welll my problem is very simple one .... i want to send request to server from my client side gui ..... .... its like that i have one class server which uses socket server.......to connect by port........ server.class ..... i have one class client wh

  • HU routing to Staging area based on destination Storage type

    Hi Experts, I have a requirement where I need to route the HUs coming out from same VAS work center to the different staging areas according to the destination storage types. Say for example, VAS Workcenter - VAS1 HUs completed out of the VAS1 workce