MSCRM record count

I have a SQL query that searched my products based on a product number.  My 
goal is to see if the product exists, and set a BOOL value accordingly.  My 
code (listed below) does work, but it seems a bit inefficient for what I want 
to accomplish.  
I’m looking for the equivalent to a COUNT statement.
Any suggestions?

QueryExpression query = new QueryExpression();
query.EntityName = EntityName.product.ToString();
ColumnSet productColumns = new ColumnSet();
productColumns.Attributes = new string[] { "productnumber" };
query.ColumnSet = productColumns;
ConditionExpression newConditions = new ConditionExpression();
newConditions.AttributeName = "productnumber";
newConditions.Operator = ConditionOperator.Equal;
newConditions.Values = new object[] { reader.Value };
FilterExpression filter = new FilterExpression();
filter.Conditions = new ConditionExpression[] { newConditions };
query.Criteria = filter;
BusinessEntityCollection retrieved = service.RetrieveMultiple(query);
bool UpdateFlag = false;

foreach (product prod in retrieved.BusinessEntities)
    UpdateFlag = true;

if (UpdateFlag)

9/11/2006 8:54:01 PM
crm 35858 articles. 1 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 4

if you prefer you could use the filtered views (filteredproduct) which means 
you can access the sql server directly and therefore use normal SQL statement.

Accessing the db directly is supported for filtered views.


9/12/2006 8:40:02 AM
Yes, that works.
Thank you.

9/15/2006 3:06:02 PM

Similar Artilces:

How to record macro clicks to ribbon bar?
I'm trying to record a macro to prototype something. The recorded macro ends up being useless because clicks on the ribbon bar are not recorded. How do you make a macro record clicks on the ribbon bar? Office 2007 Short answer: you can't. The macro recorder doesn't work this way unfortunately. You could try using the keyboard alternatives, but they probably won't be much use either as all the recorder will show is the keystrokes. But then that's the whole idea behind a macro: to save you from having to do things like click on the ribbon, open dialog boxes, ...

Inventory - Stock count
Please can anyone offer any advice on a query that has been raised regarding Stock Count Posting Journal. (GP V9) My customer has used the stock count schedule for the first time. They have entered the variances and processed the stock items. This has produced 2 journals in the GL - one with a source document of 'IVADJ' that drills back to the stock count document and another with a source document of 'GJ' (i.e. it originated in the GL). The second journal has an unexplained entry of 14p to Cost of Retail Goods Sold. My customer says the 2 journals add back to value of t...

Records not updating
I have the following code in my AfterUpdate event. I have tested it and it looks like it's going to work, but then the data doesn't get updated. What am i doing wrong? Dim rs2 As DAO.Recordset Set rs2 = Forms![frmToQCLog_v2]![frmHotSheetRecv].Form.RecordsetClone rs2.FindFirst "[ITEM] =" & Me.ITEM rs2.Edit rs2![Recvd] = True rs2![RecQty] = Me.QTY_RECV rs2.Update -- Matt Campbell mattc (at) saunatec [dot] com Message posted via ...

Hi, I'd like tu use MSCRM with UNIX on the client side (actually, the commercial people use MSCRM with Windows and IE, but there are some technical people who work with UNIX and they need MSCRM too ). Does anyone know how to do it ? (perhaps with CITRIX ?) Is someone has an idea for me, it will be very helpfull. Thank's in advance, Helen I don't know if you can do this because for access the WEB GUI of the CRM is mandatory use Internet Explorer 6 SP1. []'s Vin�cius Pitta Lima de Ara�jo "H�l�ne" <> escreveu na mensagem news:...

how do I count the number of times a word is repeated in a range?
Adapted from Dave Peterson's fine earlier post........... =SUMPRODUCT(LEN(A1:C101)-LEN(SUBSTITUTE(UPPER(A1:C101),UPPER(D1),"")))/LEN(D 1) Vaya con Dios, Chuck, CABGx3 "sol" <> wrote in message > Try here or here Hope this helps -- keithl816 ------------------------------------------------------------------------ keithl816's Profile:

Search in MSCRM
Is it possible to search in other fields than the 'name' field using the standard search (not adv. search) in MS CRM. ex. AccountNumber for Account or ProductNumber for Products? Each record type as a primary field which is always displayed in the views for that record type and it is always this field that is used with standard search facilities. You would have to use the advanced find feature to search on other columns. look at c360 searchpac, it will greatly expand your ability to do searches. tom >-----Original Message----- >Is it possible to search in other fields than t...

Want to print one record
I have access 2007. I had a person in our company's IT department design the tables & forms but that's as far as I got. Now I have numerous problems accessing information, one being the reports. So at this juncture, how can I print the information on 1 record? -- helpme Vanessa Not sure I have quite enough information ... "how" depends on "what". I suppose, if you only need to see a single record from a table, you could highlight that row, copy it, open Excel, and paste it in. But if your forms include a form that can display a single re...

Use a report to count the # records >0 in Access 2003
Hello all, I have a query that sums values and throws the answers in the field that it's value represents. I then put that in a report. 100- 2500 2510- 5000 5001- 70000 $2100.00 $0000.00 $0000.00 $1500.00 $0000.00 $0000.00 $0000.00 $4500.00 $0000.00 $0000.00 $0000.00 $7000.00 Now I need to know how many values are greater than 0 in each field which would be in the footer of the report i know count is just supposed to count the total number of records, but is ther...

add record
I have a Field Ticket form that we enter job information into. In this main form I have a sub-form that we enter the employees who worked on the job and their hours and pay information. Not all jobs, but some Field Ticket jobs are 'hazardous' and the employees will get 'hazard pay' (50 dollars flat rate). I would like to have a check box on the main Field Ticket form labeled 'Hazard Pay'. If checked, I would like to have a record added for each employee in the pay Sub-Form that gives all the same information with the Hours of 50 and the pay rate of 1 (this is ...

Modal Dialog Record and Replay
Hi, How do we do record and replay of modal dialog in a large code base ? I have created a new dialog class, say CFooDialog derived from CDialog and overridden OnInitDialog and OnOk. In OnOk, the control values are dumped into a file and in OnInitDialog the values are read from the file and controls populated. In replay mode I donot want the dialog box to be shown. For that I have overridden DoModal and done the following INT_PTR CFooDialog::DoModal() { CSagDumpDialogApp *pApp = (CSagDumpDialogApp *)AfxGetApp(); if(pApp->b_ReplayMode) { return IDOK; } return CDialog::DoModal(); } ...

fields taking data from one record to another
I have a coworker who is experiencing problems with a database that she created. The main table in this database lists client information, including first name, last name, address, etc. Within the past 1-2 weeks, they've noticed problems where people's information is incorrect when they pull records back up. For example a record this morning came up with a man's name being switched from Lawrence to Elizabeth... In every case, the field now contains the same information that is in the record before it.. so for example in this case the record before the one for Lawrence was for a wom...

Count ticked check box
In my query I want to count the Yes/No in Worksheet, so where do I enter the 0 to find out how many are ticked!..Thanks for any help..Bob Count: DCount("Worksheet","qryWorksheetActive") Oops got it, New query with a Like'-1' and then have a count column...Thanks Bob "Bob V" <> wrote in message news:e%23u$aKiqHHA.4268@TK2MSFTNGP03.phx.gbl... > > In my query I want to count the Yes/No in Worksheet, so where do I enter > the 0 to find out how many are ticked!..Thanks for any help..Bob > Count: DCount("Workshe...

Data migration from MSCRM TO MSCRM
Hi all, We are running CRM with one Database in that there are lots of data. I want move all the data into new server with fresh installation of CRM. How can do, Please any one can help. Anbu Take a back up of MSCRM & METABASE databases, Restore it on NEW SQL Server, Create empty _Crystal database, Install CRM with existing databases option. You should be good to go. Shoot me with any question you have. Q >-----Original Message----- >Hi all, >We are running CRM with one Database in that there are >lots of data. I want move all the data into new server >with fresh...

Distribution of MSCRM v3 Outlook Client
We have over 400 MSCRM users in 20 different countries. We need to distribute the Outlook Client to all those users. Group Policies are not really an option for remote users. All our users have admin priviledges on their machines. We attempted to post to an FTP site but there any many files and it is quite large. How do you recommend distributing the client? Is our only option to burn CDs for distribution? Thanks! Shelley, You're right, this will be an issue for you since the Client package is almost 400MB. You can go the CD route or copy the CLIENT folder installation to strateg...

CRecordset class giving Exception Query Timed Out With SQL Server if No Of Records are very large
Hey Friends I am creating a database application which is interacting with SQL Server. I am using CRecordset class for database interaction,the problem arises when the recordset is of very large no of records.I am using forward only recordset. I wish to know that if the recordset is of 10 lakh records and i fire a query which fetches all records then whether all the 10 lakh records will be fetched into my application or some better management is there by CRecordset ? bhatia, You may need to increase the query timeout value on the connection. Have a look at the CDatabase::SetQueryTimeout me...

Reocurring Records
Hi I have a vehicle checkout database where you can click on a button and it will take you to a form where you can select a vehicle and choose the start date, end date, start and end time ect. Is their a way where a person could enter a reoccuring date and time that they will need a certain vehicle? For instance dept. A will need the 2000 dodge Intrepid every Monday from 8am to 9am. I'm not sure how to go about doing this or if it is possible. Any help is appreciated. Thanks -- Message posted via

Add Fake Records to Query from Table
I have a table that contains real data and then I have a table that has dummy data that is needed for another program that I'm sending the file too. I need to figure how to put them in the same colunm in the table. Here is my statement. SELECT [DBA_DEVICES]![deviceName] & " " & [DBA_ITEMS]![itemId] AS [Station Name & Item], DBA_ITEMS.itemName AS [Item Desc], DBA_POCKET.pktParQty AS Par, DBA_POCKET.pktRefillPoint AS Refill FROM [DocFinity Fake Records], (DBA_ITEMS INNER JOIN (DBA_POCKET INNER JOIN DBA_DEVICES ON DBA_POCKET.deviceIid = DBA_DEVICES.device...

Duplicate record
Hello All,I have a table of two columns (Name & Number) that is sorted in ascending order on the NAME column and descending order on the NUMBER column, example below ;Name NumberFred 2Fred 1Dave 1Bill 2Steve 3Steve 2Steve 1I want to run a query that will return ONLY the top record of each name, example results belowName NumberFred 2Dave 1Bill 2Steve 3Is this possible ??Any info would be very appreciatedRegardsKB sorted, the answer was in a previous post .. :-)cheersKB----------------------------------- --- -- -Posted wi...

Applying changes to record
Is there any way in Access 2003 to apply any edits to a record or entry of a new record only when a user clicks on a button? Like when you edit a document, changes aren't applied to the document file unless you click save or save as. i usually get around this by turning off the Close X button in the form properties, and the making my own button for Cancel/Close that uses the Undo Record change command. that way they are forced to either click save, or click cancel and are not able to simply close the form by clicking the X. You could use the form's Current event to set ...

sbs 2003 and mscrm
I just installed sbs 2003 and mscrm 1.2 pro. The server works fine until I turn on mscrm, when I do that the exchange and the web server go's down after about half hour. Has anybody seen this and know the solution to fix it. Thank you David Tolleson How many users on your sbs? and how much ram in your box? What does the event logs say? -Fisheye "David Tolleson" <> wrote in message news:019301c4a4cc$50c04cc0$a601280a@phx.gbl... >I just installed sbs 2003 and mscrm 1.2 pro. > The server works fine until I turn on mscrm, when I do > that ...

ACCPAC, SAP integration with MSCRM 1.2
We are looking at purchasing an accounting package and would like to integrate it with CRM which we have at the moment. Has anyone done this integration with the above products? Is it worth using MSCRM or go with CRM that comes with the above prodcuts? The amount of data in the MSCRM is minimal and would not matter if it was blown away. Any feed back would be appreciated Thanks Karl Karl, I've built a few custom integrations between MSCRM and other apps. Depending on what you need to do, they aren't all that difficult to build, but there is obviosuly a lot of detail to be con...

update certain records
Hi, Is there a way to run update table to update a certain number of records (determined by the user in an unbound txtbox on a form)? On Thu, 17 Jan 2008 12:06:01 -0800, Pietro <> wrote: >Hi, > Is there a way to run update table to update a certain number of records >(determined by the user in an unbound txtbox on a form)? Possibly, but the question is ambiguous. If you have 1000 records in the table and the user says to update 10 of them, WHICH 10 do you want to update? What exactly are you trying to accomplish? What's the data in the...

Duplicate detection detecting inactive records?
Is there any way to configure duplicate detection to not look at inactive records? I can't find any way to set this on the rules. Thank you! ...

I need help has to do with counting
Okay guys I have an excel worksheet and this is what i need to do. I'm entering numbers and at the end I want a sum. But the thing is that it is not a sum of all the numbers within the cells but a sum of the number of cells that have a number on it in a row. Like if the row looks like [Blank cell]- 5 - 1 - [Blank cell] I want at the end of the row a sum that is equal to 2 because only 2 cells have numbers on it. Does it makes sense? Can I do this in excel? -- ladivapr ------------------------------------------------------------------------ ladivapr's Profile: http://www.excelfor...

How to access MSCRM with VB6 or ASP
Did anyone has a sample code to access MSCRM using VB6 or traditional ASP? As a starter, there is a COM tlb file in the server \bin folder which gives you access to the proxy. I haven't used anything except C# - I think that VB/VBScript may make you go through hoops to get it working. Stephen "Daniel Horng" <> wrote in message > Did anyone has a sample code to access MSCRM using VB6 or traditional ASP? Unfortunately all code that I have seen for Microsoft CRM assumes you are using a .NET lan...