Check list field values using LINQ

I have to check if the CURRENT USER is already in the list USERS by comparing his AccountName to the list field ACCOUNTNAME.
If the USER is on the list I have to check if the field IsFollower is YES or NO and change it according to some conditions.
I think LINQ would be the correct way of doing this but I have no clue how to do that.
Any ideas pls, thanks

Hi,
Yes, you can query the list using LINQ.
You need to get the SPList Object firstly, and then you can query list item value using LINQ.
More information about how to check list field value using LINQ:
http://msdn.microsoft.com/en-us/library/office/ee538250(v=office.14).aspx
http://www.wolfsys.net/query-sharepoint-lists-with-linq/
http://geekswithblogs.net/TanviBlog/archive/2013/06/06/linq-in-sharepoint-and-querying-list-items.aspx
More information about how to use Server Object Model in SharePoint lists:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.aspx
http://msdn.microsoft.com/en-us/library/office/ms456030(v=office.14).aspx
Best regards

Similar Messages

  • UDF for Checking the field value

    Hi
    I want to check the whether the fiels conatins any value or not in mapping ... if not i want to raise the exception using the UDF
    DO any one have sample code for writing the UDF
    SV

    Hi SV
    what is your requirement first that should br clear.
    i am giving you two UDF
    1) i have written this uDF for string and comparing the field value XYZ
    2) i am entering a string and its returning aa string which starts from the index of your input fixed length
    int len = a.length();
    String res = "";
    String temp = "";
    if ( len >= 10)
    temp = a.substring(0,10);
    if ( temp.equals("XYZ"))
    res = temp;
    else
    res = "";
    return res;
    =======================================
    String fixed = "ABCD";
    String res = "";
    int index = -1;
    index = a.indexOf(fixed);
    if (index == -1)
    res = "NO INDEX FOUND";// or if u wanna set it as null res = "";
    else
    res = b.substring(index4,index12);
    return res;
    ===
    hope these may solve your problem
    Thanks
    Sandeep sharma
    If helpful reward points

  • How to create a list of value using date?

    We need to create a list on a report. The list consists of date. I have tried several times, but no luck.

    Hi Charles,
    I guess you have a user-parameter in your report and you need to define the LoV for the user parameter, so that the user can select from the LoV. In such a case you get REP-0782 if the datatype of column does not match the LoV of the parameter. Eg, if you have a query like
    select * from employees where hire_date < :p_hire_date
    And you want to build an LoV for hire_date, do the following:
    1. Go to your user parameter > Property Inspector > Datatype > select "Date". If you select Character or Number, you will get REP-0782.
    2. Now double click List of Values, choose "Select Statement" and type something like
    select distinct hire_date from employees order by hire_date asc
    If you don't want to use a Select Statement to build the LoV, you can write a static list of values, and even in this case Step 2 above should avoid the error REP-0782.
    Navneet.

  • List of Values using page item variable

    I know there has to be a simple solution to my problem but I cannot figure it out. Any assistance would be greatly appreciated.
    I have a Shared list of values that I want to reuse on several of my pages. I have tried (I thought) all the variable possibilities but cannot figure out how to reference the page item in my list of values.
    Original code:
    select app_name d, app_sys_id f
    from ops_application
    where :P32_RADIO2 = 'Application'
    union
    select db_name d, db_id f
    from ops_database
    where :P32_RADIO2 = 'Database'
    Doesn't work:
    select app_name d, app_sys_id f
    from ops_application
    where 'P'||:APP_PAGE_ID||'_RADIO' = 'Application'
    union
    select db_name d, db_id f
    from ops_database
    where 'P'||:APP_PAGE_ID||'_RADIO' = 'Database'
    I also have tried 'P'||v('APP_PAGE_ID')||'_RADIO'
    'P'||&APP_PAGE_ID.||'_RADIO'
    'P&APP_PAGE_ID._RADIO'
    'P'||:APP_PAGE_ID||'_RADIO'
    Thanks,
    Gayle
    Edited by: user8116955 on Sep 27, 2010 12:25 PM

    Gayle,
    I haven't tried this, but what about
    where v('P'||:APP_PAGE_ID||'_RADIO') = 'Application'That should allow you to build up the name of the page item dynamically, and then test the value...
    A lower-quality solution would be to use an application item rather than a page item, as then you'd know the name ahead of time.
    Let me know if this works,
    -David

  • Extracting a distinct list of values using the Index formula

    In Xcelsius, I am trying to retrieve a distinct list of values from data imported using the Reporting Services button.
    In the spreadsheet I am using the following formula:
    =INDEX($A2:$A831,MATCH(0,COUNTIF($B$2:B2,$A2:$A831),0))
    The above formula works correctly in Xcelsius, but when I select the preview button the values change to #N/A.
    Please could you advise on why this does not work?
    Many thanks,
    Natalie

    Hi Natalie,
    First, you have to be aware of the fact that Xcelsius "simulates" an Excel function. When you are in design mode, the actual "Excel" (MS code) functions are executed. But when you are in preview mode (or export to a swf), all Excel functions are simulated (Xcelsius code).
    The fact that your function works in design mode but not in preview/export may point to a bug.
    But there are also certain assumptions (to address speed/efficiency) on the Xcelsius code which may cause the preview to fail. One such assumption is that on the VLOOKUP function, Xcelsius does not recalculate formulas in the index column of the VLOOKUP table array - if the index column contains formulas, the index column will always remain in the initial state (will not dynamically recalculate).
    Also, not all features on a supported Excel function works. For example, array formulas are not supported.
    Bobby

  • List of Values using WeCheckbox

    I attempted to apply the same principles in using shared variables within a subreport to populate the values for WeCheckbox function. Although I was able to get the list of values to populate as desired, something strange happened when I tried to use the name of the variable within WeBuilder function. When I referenced the exact variable, it doesn't show up on the report. However, if I just use "Checkbox" in the WeBuilder function, everything displays perfectly. The obvious problem is that I can't capture the selected checkbox with a Submit button, as it never displays that it is capturing the user selected checkbox when passing parameters to the target report. Is it possible to use a list of values to populate the WeCheckbox function and also be able to pass the values to a target report?

    hello Eric,
    i am not sure if i understand the issue. can you please change the WEBuilder's debugging mode to "2" so that it will display the url that it is generating...what is the url that is being generated and what is wrong with the particular url when the end user selects a checkbox and presses submit?
    jw

  • Check of field values from the delivery address in PO

    The customer likes to check a field from the delivery address (f.e. NAME1) before the PO is saved. I looked for Userexits but diddn't find any. The only way sees to be a modification. The question is where to modify...

    Name 1 fields is under Delivery Address tab for PO line item details.        -> This was not my question
    It can be maintained i n SPRO itself by defining Address for store locations .  -> This was not my question
    User have to put storage location in PO line Item itself then Name 1 field will displayed values in SPRO -> This was not my question
    It has to be CHECKED by the system if the content of field NAME1 (from wherever the system gets the address) equals to a special text. There must be a statement such as:
    if ADDR1_DATA-NAME1 eq '1234657678' ....
    The problem is to identify the right include where i can get the relevant fields.

  • Accessing recordset field values using labview Active X

    dear friends,
    i have opened recordset using labview active X Refenum opening dbengine,workspace ,opendatabase,openrecordset
    i need to access the field value from the record
    but labview doesnot show any propery or methods that r related to fields ,except count.
    in short i am looking for a code statemant in labview which is equivalent to VB
    Recordset.Fields("Name").Value or Recordset.Fields(Index).Value
    can anybody help
    thanks in advance
    regards
    shridhar joshi

    try something like this .
    "shridharjosh" wrote in message
    news:[email protected]..
    > dear Ben Schulte
    > i am using MS Access Database and i opened
    > Acitve X class and necessary database connection parameters
    >
    > thing is Fields is a collection in VB and
    > has a two default properties 1-Count 2-Index
    >
    > I am Able to get count property but un succesfull in accessing index
    > this is important inorder to acces the value of a individual field in
    > a recordset
    > i am attaching data vi with this please ahve a look at it
    >
    > thanks in advance
    [Attachment Fields.PDF, see below]
    Attachments:
    Fields.PDF ‏175 KB

  • Issue facing : Deletion of Qualified Look up field value : Using Import Map

    Hi All,
    We are having qualified multi-valued look up field in the main table. Using import map for the main table record update, we are trying to delete the qualified look up field value. But it is not working.
    Please guide on how you have achieved this.
    One approach is to supply NULL value, though I am not sure or have tried this.
    Regards,
    Ganga

    Hi Ganga,
    I assume that you are trying to delete the Qualifier values for the Qualified look up table. The only possibility is to pass the Null values to the already Existing records in the Main table. Please note that if you are passing one Null value only one record will get deleted. So you will have to pass the Null values equivalent to the number of values for the Multi Valued Qualified table.
    Kind Regards,
    Thamizharasi N

  • How to get a list of values used in the WHERE filter of stored procedures and functions in SQL Server

    How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
    How can get a list of values as shown (highlighted) in the sample stored procedure below?
    ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
    SELECT   [LOAN_ACCT].PROD_DT,
                  [LOAN_ACCT].ACCT_NBR, 
                  [LOAN_NOTE2].OFCR_CD, 
                  [LOAN_NOTE1].CURR_PRIN_BAL_AMT, 
                  [LOAN_NOTE2].BR_NBR,
    INTO #Table1
    FROM
                    dbo.[LOAN_NOTE1],
                    dbo.[LOAN_NOTE2],
                    dbo.[LOAN_ACCT]
    WHERE
                    [LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
                    and
                    [LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
                    and
                    [LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
                    and
                    [LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
                    and
                    [LOAN_ACCT].PROD_DT = '2015-03-10'
                    and
                    [LOAN_ACCT].ACCT_STAT_CD IN
    ('A','D')
                    and
                    [LOAN_NOTE2].LOAN_STAT_CD IN
    ('J','Z')
    Lenfinkel

    Hi LenFinkel,
    May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
    I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
    For multiple values paramter you can use a
    table-valued parameter. Then there's no problem getting the values.
    If you could elaborate your purpose, we may help to find better workaround.
    Eric Zhang
    TechNet Community Support

  • How to check list of  transactions used  for a certain period of time

    Hi
    Is there a way to check the transcations that were used e.g the past two months apart from using transaction STAT or sm19 or sm20.
    Thanks

    Hi..  i have got a similar request like yours.... i need to find the list of 
    list of transactions used by all users in a user group (in my case PLKR) in the past two months.
    is this possible to find???

  • Reading deleted field values using change pointer

    hi
    i am triggering DEBMAS06 using change pointer technique for XD01/02/05/06 transactions.
    now when i delete data(make nulll values) in partner functions the generated IDOC is not showing the complete field itself.when i am deleting the field value and making it null the IDOC must send the fields with null values.but unable to trace out how to do this.
    can anyone let me know how to handle this situation?
    and i have extended DEBMAS06 with customer hierarchy data i.e. KNVH.i have written change pointers.now how can i populate these fields into my extension?

    Hello Moorthy,
    1. This message function in the Idoc is populated as 005 then it should replace the entrire values while posting,
    2. To populate KNVH extension you have to populate this only if you have KNVV data.. so you can either create enhance menti perfrom FILL_SEGMENT_E1KNVVM i(nf Function moduler MASTERIDOC_CREATE_DEBMAS) inclduer LVV01F01. or you can write the logic in BAdi CUSTOMER_ADD_DATA->FILL_ALE_SEGMENTS_OWN_D or in user eixt EXIT_SAPLVV01_001.
    Regards
    Naresh

  • How to Set Field value using javascript?

    I have a Field in First Page called 'SO'. I want to populate this field from the field value of SD_ITEMS.DATA.VBELN first row in the each page. Please help me with javascript to set this value.
    Thank you.
    Ranji

    I have a Field in First Page called 'SO'. I want to populate this field from the field value of SD_ITEMS.DATA.VBELN first row in the each page. Please help me with javascript to set this value.
    Thank you.
    Ranji

  • List of Values use Master Data or Trasaction Data?

    Hello,
    Do anyone of you from where does data in the list of values is populated Transaction data or Master data or combination of both?
    I know bex query could be built on a DSO, Info Cube, Info set, Mutiple Provider and Info objects. Is dependent on the type of info provider the query is built on? Could we really control the source in the lov's
    Thanks
    Ram

    its based on the data in the InfoProvider.
    Ingo

  • Deleting field value using bapi

    Hi all,
    I want to delete a field VBAP-FIXMG from a report because it is wrong fixed.
    but i want to delete it using a bapi.
    can any one help me out which bapi to use and how to use it.
    thanks.

    Hi,
    Use the BAPI " BAPI_SALESORDER_CHANGE". U can check the docuemntation of it and also where used list to see if we can use the bapi.
    Regards,
    Nagaraj

Maybe you are looking for

  • Horrible customer service

    I have been with Verizon since 1998 and have had numerous customer service issues. The latest has been the worst ever taking over 7 hours on the phone with various customer service reps and supervisors.  This issue has NOT been resolved.  We have bee

  • How to build such mapping?

    Hi XIer, I am currently working on such mapping requirement as following: source structure: <MT_SRC>   <row> - 1 to unbounded      <ID>001</ID>      <Name>Jonathan</Name>      <Age>27</Age>      <***>M</***>      <JobCode>123456</JobCode>   </row>  

  • Setup of  security issue

    Hi Gurus, Please help! What do we need to do to resolve the below security issue? The Functional Guys says: I do not know how an authorization group on the material master works within SAP security.  For example, we need to be able to prevent someone

  • IPHONE US VS IPHONE UK

    A question, iphones in the UK are expensive, is it possible to go to the US(a friend going on holiday there soon), bring one back, and get an o2 sim from the store iphone compatible ofcorse. Help Plz Thx Scott

  • XD02 and FD02- tax

    Hello SAP Gurus' I have a problem I hope you can help me with.  We use TAXWARE and when we input the exemption or resale number/ tax number via XD02, it changes for all co.codes???  We only want a change to the co.code we have entered and it appears