How to sum a column value using CAML Query?
Hi All,
I would like to sum the column value using CAML qeury. Actually in my list, I have two column "Projects Name" and "Number of Issues". Now need to get sum of "Number of Issues" column. How to achieve in CAML Query.
Thanks in advance!
Hi Sam,
it looks like you can use your current view based agregation, otherwise it is not possible(
http://msdn.microsoft.com/en-us/library/ms467521.aspx) and you need to work on custom bit on this requirement.
use the below link and create a view element as described and see if that works for you
Aggregations Element
http://msdn.microsoft.com/en-us/library/ms468626%28v=office.12%29.aspx
Another reference
Query Element
http://msdn.microsoft.com/en-us/library/ms471093.aspx
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you
Similar Messages
-
Sum and group by using CAML query
Is there any way to get the SUM of values with group by ID using CAML query?
I have a custom list, in that I have ID and Value columns as below
ID Value1 Value2
1 10 4
2 5 3
1 15 2
3 20 1
I want to get result:
ID Value1 Value2
1 25 6
2 5 3
3 20 1
I used CAML query:
<View>
<Query>
<Where>
<IsNotNull>
<FieldRef Name="ID" />
</IsNotNull>
</Where>
<GroupBy Collapse="FALSE">
<FieldRef Name="ID" />
</GroupBy>
</Query>
<ViewFields>
</ViewFields>
<Aggregations Value="On">
<FieldRef Name="Value1" Type="SUM" />
<FieldRef Name="Value2" Type="SUM" />
</Aggregations>
</View>
But
this query returns all the records
that satisfy the condition <Where>.
I
do not correctly?You need to work with current view based aggregation. Please check below threads for your reference.
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/dda5735a-fecf-403f-9495-1b63617d2fbf/question-on-a-caml-query?forum=sharepointdevelopmentlegacy
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/24e88d6a-ee15-4d81-a5fe-504c7bd14e46/how-to-sum-a-column-value-using-caml-query?forum=sharepointdevelopment
Hope this helps.
My Blog- http://www.sharepoint-journey.com|
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
I've seen these
issues and articles and do them, but
does not work. I use object mozhel
Sharepoint (javascript). -
How to get Metadata column values using powershell(CSOM)
Hi,
I am trying to get list column values using Powershell (CSOM), but I am getting for Metata data columns.
I am getting internal value as System.Collections.Generic.Dictionary`2[System.String,System.Object]
Can anybody let me know how to get the values for metadata columns?
Any help would be greatly appreciate.
Thank you.
AA.Hi
Go through the links. It'll help.
SharePoint 2013 Code Tips – Setting a Managed Metadata Field with the Client Object Model(CSOM and JSOM)
Indul Hassan
Microsoft Community Contributor
http://www.indulhassan.com
You Snooze.. You Lose !! -
How to read repeated tag values using sql query
Database version
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Question
How to get repeated tag values?
<TXLife>
<TXLifeRequest>
<TransRefGUID>10bc80e7d60e59b0:a134d0:10d7c4674ad:-7ffd</TransRefGUID>
<TransType tc="1203">OLI_TRANS_TRNHLD</TransType>
<TransExeDate>2011-02-27</TransExeDate>
<TransExeTime>15:06:35</TransExeTime>
<InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
<InquiryView>
<InquiryViewCode>PLANUPDATE_CHBM_1203A</InquiryViewCode>
</InquiryView>
<OLifE>
<SourceInfo>
<SourceInfoName>CHBM Admin Tool</SourceInfoName>
</SourceInfo>
<Activity id="Activity1" HoldingID="Holding1">
<UserCode>User123</UserCode>
<LastUpdate>2011-02-27</LastUpdate>
<ActivityCode>CHBM10001</ActivityCode>
<OLifEExtension VendorCode="0098" ExtensionCode="Activity">
<ActivityExtension>
<SubActivityCode>CHBM20002</SubActivityCode>
<LastUpdateTime>15:06:35</LastUpdateTime>
</ActivityExtension>
</OLifEExtension>
</Activity>
<Holding id="Holding1">
<HoldingTypeCode tc="6">Group Master Contract</HoldingTypeCode>
<Purpose tc="36">Business Protection and Preservation</Purpose>
<Policy>
<CarrierAdminSystem>CHBM</CarrierAdminSystem>
<PolNumber>CHB0001234</PolNumber>
<OLifEExtension VendorCode="0098" ExtensionCode="Policy">
<PolicyExtension>
<BillingDetail>
<PaymentMode tc="3">Quarterly</PaymentMode>
<BillingOrder tc="1009800002">Employee ID</BillingOrder>
</BillingDetail>
<SalaryAllotment>12354333</SalaryAllotment>
</PolicyExtension>
</OLifEExtension>
</Policy>
<Attachment id="Attach1">
<DateCreated>2011-02-27</DateCreated>
<UserCode>System</UserCode>
<AttachmentBasicType tc="1">Text</AttachmentBasicType>
<Description>Event 4</Description>
<AttachmentData>Event Log</AttachmentData>
<AttachmentType tc="1009800001">Transaction Log</AttachmentType>
<AttachmentLocation tc="1">Inline</AttachmentLocation>
<OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
<AttachmentExtension>
<Sequence>2</Sequence>
<CreationTime>16:05:45</CreationTime>
</AttachmentExtension>
</OLifEExtension>
</Attachment>
<Attachment id="Attach2">
<DateCreated>2011-02-27</DateCreated>
<UserCode>System</UserCode>
<AttachmentBasicType tc="1">Text</AttachmentBasicType>
<Description>Event 3</Description>
<AttachmentData>Event Log</AttachmentData>
<AttachmentType tc="1009800001">Transaction Log</AttachmentType>
<AttachmentLocation tc="1">Inline</AttachmentLocation>
<OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
<AttachmentExtension>
<Sequence>1</Sequence>
<CreationTime>16:01:54</CreationTime>
</AttachmentExtension>
</OLifEExtension>
</Attachment>
<Attachment id="Attach3">
<DateCreated>2011-02-27</DateCreated>
<UserCode>P62350</UserCode>
<AttachmentBasicType tc="1">Text</AttachmentBasicType>
<Description>Note 2</Description>
<AttachmentData>Enter notes on changes or edits to plan</AttachmentData>
<AttachmentType tc="14">Note</AttachmentType>
<AttachmentLocation tc="1">Inline</AttachmentLocation>
<OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
<AttachmentExtension>
<Sequence>2</Sequence>
<CreationTime>16:02:23</CreationTime>
</AttachmentExtension>
</OLifEExtension>
</Attachment>
</Holding>
</OLifE>
</TXLifeRequest>
</TXLife>
Expected output shoulb be like this
Description AttachmentType AttachmentData
Event 4 Transaction Log Event Log
Event 3 Transaction Log Event Log
Note 2 Note Enter notes on changes or edits to plan
Please help me any one on this
Edited by: LRAJESH on Apr 20, 2011 8:27 AMSELECT
t2. Description des,
t2.AttachmentType attty,
t2.DateCreated DateCreated,
t2.UserCode UserCode,
t1.Planid Planid,
t2.createdtime,
t1.Ausercode Ausercode
FROM (
SELECT xData doc
FROM dual
) temp_table,
XMLTable ( '/TXLife/TXLifeRequest/OLifE' passing doc
COLUMNS
Planid varchar2(20) path 'Holding/Policy/PolNumber',
AttachmentType xmltype path 'Holding//Attachment' ,
Ausercode varchar2(20) path 'Activity/UserCode'
) t1,
XMLTable
'/Attachment'
passing t1.AttachmentType
columns
Description varchar2(1000) path 'Description',
AttachmentType varchar2(1000) path 'AttachmentType/@tc',
DateCreated varchar2(20) path 'DateCreated',
createdtime varchar2(20) path 'OLifEExtension/AttachmentExtension/CreationTime',
UserCode varchar2(200) path 'UserCode'
) t2 -
How to show the VALUE as the Column Header using SQL query?
Hi
I have a requirement to show the picked value as the column header using SQL query.
Example:
======
SELECT EMPNO FROM EMP
WHERE EMPNO=7934;
Result Should be:
7934
7934I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
SQL> set verify on
SQL> def e = 7934
old: SELECT empno "&&e" FROM emp WHERE empno = &&e
new: SELECT empno "7934" FROM emp WHERE empno = 7934
SQL> SELECT empno "7934" FROM emp WHERE empno = 7934
7934
7934
1 row selected. -
How to swap column values using variable in sql?
Hi,
I have a table and i want to swap two column values using variable
please help meHi,
Let us assume that the DeptNAME and DeptNo columns are of type VARCHAR2. However, DeptNO column is VARCHAR2(10) and DeptNAMe is VARCHAR2(100).
First of all DeptNo column needs to be modified to be 100.
i) ALTER TABLE DEPT MODIFY DEPTNO VARCHAR2(100);
Secondly, you will swap DEPTNAME and DEPTNO values using the SQL as follows:
ii) update dept t1
set deptname = (select deptno from dept2 t2 where t1.deptno = t2.deptno),
deptno = (select deptname from dept2 t2 where t1.deptno = t2.deptno);
Now, finally you want the deptname columns to be VARCHAR2(10)
iii) ALTER TABLE DEPT MODIFY DEPTNAME VARCHAR2(10).
If DEPTNO is a NUMBER column, you cannot alter the datatype unless the table is empty; in that case the whole swapping requirement would be moot.
Trinath Somanchi,
( http://www.myospages.com ) -
I am looking for a way (action script code?) to sum datagrid
column values.
I am using Flex2 with Cold Fusion MX7.
I populate a DataGrid by setting dataprovider to the result
of a Coldfusion query.
(this.masterList.dataProvider = event.result as
ArrayCollection;)
This all works fine.
The masterList datagrid has debit, credit, and unitcost
columns. I want to sum those columns individually, and display the
results in text boxes in another panel.
I could run a Coldfusion query to return the sums, but would
like to do it on the client side with action script.
I want to sum them everytime I update the datagrid, so need
action code that I can put in the result function.
I am new to ActionScript, and not sure how to loop through
the array collection(and/or) dataprovider and sum the items.
Any help would be appreciated.
Thanks.Loop through your array..if the arrayCollection was named
myArray;
private sumFunction():Number{
var sum:Number=0;
for(var i:uint=0;i<myArray.lenght;i++){
sum+=myArray
.debitValue;
return sum; -
Return all the column values using the F4IF_INT_TABLE_VALUE_REQUEST
Hi,
How to return all the column values using the F4IF_INT_TABLE_VALUE_REQUEST?
For example : if the row has 3 columns then after selecting the particular row, the RETURN_TAB internal table should contain all the three column values.
Regards,
RaghuHi,
Try the following...
DATA : it_fields like help_value occurs 1 with header line.
data: begin of w_vbap,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
werks like vbap-werks,
end of w_vbap.
data: i_vbap like w_vbap occurs 0 with header line,
w_fields type help_value,
i_dfies type table of dfies,
i_return_tab type table of ddshretval with header line,
i_field type dfies.
select vbeln posnr werks
from vbap into table i_vbap up to 5 rows.
if sy-subrc = 0.
sort i_vbap by vbeln.
endif.
clear it_fields[] , it_fields.
it_fields-tabname = c_vbap.
it_fields-fieldname = 'VBELN'.
it_fields-selectflag = c_on.
append it_fields.
it_fields-tabname = c_vbap.
it_fields-fieldname = 'POSNR'.
it_fields-selectflag = space.
append it_fields.
it_fields-tabname = c_vbap.
it_fields-fieldname = 'WERKS'.
it_fields-selectflag = space.
append it_fields.
loop at it_fields into w_fields.
i_field-tabname = w_fields-tabname.
i_field-fieldname = w_fields-fieldname.
i_field-keyflag = w_fields-selectflag.
append i_field to i_dfies.
endloop.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'VBELN'
window_title = 'Select'
tables
value_tab = i_vbap
field_tab = i_dfies
return_tab = i_return_tab
exceptions
parameter_error = 1
no_values_found = 2
others = 3
read table i_return_tab into w_return_tab index 1.
if sy-subrc = 0.
endif.
Regards,
Srini. -
How to refer a column value of a single row in conditional column display?
Hello,
does anybody have an idea, how i can refer a column value of a single row in conditional display of a column?
So my idea is, that a report has a column, which value is only displayed, when another column value of this row has a specific value.
I want to solve this problem with condition type: PL/SQL Function Body returning a boolean.
But I do not know how to refer the column value of each single row!
Thank you,
TimHere's a solution that, to me, seems easier to implement but, that's, of course, in the eye of the implementer.
Rather than using APEX to generate a link column for you, actually create the link as part of your SQL.
select '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>' CONTACT_LINK, ...
etc.
Test this out. You'll see that it works just like making a column a link using the column attributes.
Next, we'll change the SQL to use a DECODE statement to either display the link or nothing depending on what your criteria is. For example, let's assume you only want a link for active contacts.
select Decode( CONTACT_STATUS, 'A', '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>', NULL ) CONTACT_LINK, ...
etc.
This will not display the link in any rows in which the CONTACT_STATUS is not active, i.e. "A"
-Joe -
How to Update some column values in some rows in an advanced table
Hi Gurus,
Can any body help on this issue.
I am having a results table which is showing all the queried parties data queried in a seeded page in OCO module.
Lets assume the table contains 10 rows with the below columns
Party Name, Registry ID, Address Country, Match Percentage, Certification Level, Certification Reason, Internal Indicator, Status .
Certification Level, Certification Reason and Internal Indicator are the dropdowns.
The user want to update some of these fields values for some rows randomly.
After doing this if he click on Save button, Only thosed changed rows need to get update using a Custom Procedure.
But here all the rows irrespective of the change getting updated.
So how to capture the modified rows.
Appreciate any inputs..
Thanks
Palepu
Edited by: Palepu on 9 Aug, 2012 4:25 PMNot sure if you got the answer. You need to capture the row which got changed using the below and get the column value using the getAttribute method. This works for single selection row, if it is multi selection then you will have to loop through all selected rows and find the VO attribute value.
String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Row currentRow = am.findRowByRef(rowReference);
String param1= (String)currentRow.getAttribute("VOAttribute");
Let me know if there are any issues.
Thanks
Shree -
hi
i am new to programming... i would like to know how to get the column values... i have a resultset object
i need code .... asap
thnx@OP: It is always good to type complete sentences and describe your problem at length. It helps in letting people know what you really need instead of making wild guesses or silly jokes. You post mentions that you get the ResultSet. Then you should look up the API docs for java.sql.ResultSet and take a look at the getxxx() method signatures. Use the ones which suit the specific case.
Besides, it is good to refrain from using asap and urgent. Even if something is urgent to you, it need not be urgent to others. Wording a question properly would attract better replies.
Finally, would you mind getting down to specifics of your problem? From what I perceived, the JDBC tutorial and the API docs should provide all the information you need. -
How to sum the column in a table seperated by sign.
How to sum the column in a table separate by sign.
For Example:
A B
10 MOHAN
-15 KUMAR
-25 MARCH
50 MAYSELECT SUM(CASE SIGN(A) WHEN 1 THEN A ELSE NULL END) SUM_POSTIIVE,
SUM(CASE SIGN(A) WHEN -1 THEN A ELSE NULL END) SUM_NEGATIIVE
FROM tbl
/SY. -
How do I save preferences/values using javascript in dashboard widget?
How do I save preferences/values using javascript in dashboard widget? I apologize if this is a stupid question but I simply cant seem to find a way. For example, if on teh back side of the widget teh user chooses the color of the widget, where or how do I save that value so it is retained the next time the user goes to the dashboard. Also, once saved, how do I read the value?
Thanks a mil....Please look into
/Developer/Examples/Dashboard/Goodbye World/3-Saving Preferences directory for a comple example.
Otherwise, wait until the following book is published :-))
http://www.apress.com/book/bookDisplay.html?bID=10173
Mihalis. -
How can I change the value used in a Criteria Rule in a Subscription agent
Dear mobile heroes.... How can I change the value used in a Criteria Rule in a Subscription agent in a quality environment? (CRM 70 SP04).
I have built a subscription agent in dev, which uses a static where clause to filter activity_object on VKORG. I need to filter on a different VKORG value in the quality environment, but when I change the value of the sales org, the change is not saved. I have tried this even non 'activated' subscription agents, but it still does not appear possible to change and save the changes.
This poses a big problem because the VKORG value I want to use does not even exist in the dev environment, so I could not even rebuild in dev and transport the new agent to quality. Can anyone help me?Too old to care now.
-
How to make muliple column listbox using indesign cs3
Hi,
I want to create list box having muliple rows and columns. I tried with one cloumn using tree view and that is working fine. How to create multiple column listbox using tree view. I need a code snippet for muliple rows and columns using treeview.
Thanks
K.SaravananDownload the CS6 SDK. Under the "open" folder you will find the code for the LinksUI panel. This is the closest you will get to a multicolumn list box in C++, if you want to stay in C++.
The tree view widget support dynamic load of sub nodes in a tree. Also it will only request widgets to drawn when they are in view (as far as I remember).
Maybe you are looking for
-
Setting servlet mapping?
a newbie question: My servlet are running fine when requested by: http://myMachine.com:7777/j2ee/servlet/com.whatever.MyServlet However I want it to be reached by: http://myMachine.com:7777/servlet/com.whatever.MyServlet note the missing "/j2ee". Wha
-
Is it possible to open iPhoto twice under os-x lion, to create a photobook on one desktop and to have a look to the photos in full size on the other desktop?
-
Problem with month to month subscription of Illustrator
Hi - I have the month to month subscription of Illustrator on my computer. Today it won't open and says I am missing certain plug-ins? Like "round corners"? How do I fix this?
-
Connecting an existing VC model to another SAP system
Hello, Can anyone tell me how to connect an existing Visual composer model which resides on the VC Development system to different SAP System? Now the VC development system is connected to the DEV erp system (rfc, bapi etc.) and I wish to connect the
-
Can I copy photos found on a 2005 iLife Backup DVD?
I have a stack of DVDs containing a full backup, using iLife Backup, from 2005. I have "lost" some photos that I am hoping are somewhere on these disks. There would be nothing else on those discs that interest me and I would like to throw them away