Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
From: "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vantage/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/vantage/join
(Yahoo! ID required)
<*> To change settings via email:
vantage-digest@yahoogroups.com
vantage-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
vantage-unsubscribe@yahoogroups.com
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select r.AllocatedQty);
decimal sum = PartAllocRows.Sum();
From: "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com>
To: "<vantage@yahoogroups.com>" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 7:04 AM
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vantage/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/vantage/join
(Yahoo! ID required)
<*> To change settings via email:
vantage-digest@yahoogroups.com
vantage-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
vantage-unsubscribe@yahoogroups.com
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select (r.AllocatedQty - r.PickedQty));
decimal sum = PartAllocRows.Sum();
From: "Ted Koch tkoch77@... [vantage]" <vantage@yahoogroups.com>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 7:34 AM
Subject: Re: [Vantage] E10: SQL to LINQ
#ygrps-yiv-2086569323yiv8332450966 .ygrps-yiv-2086569323yiv8332450966ygrp-photo-title{
clear:both;font-size:smaller;height:15px;overflow:hidden;text-align:center;width:75px;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966ygrp-photo{
background-position:center;background-repeat:no-repeat;background-color:white;border:1px solid black;height:62px;width:62px;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966photo-title
a,
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966photo-title a:active,
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966photo-title a:hover,
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966photo-title a:visited {
text-decoration:none;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966attach-table div.ygrps-yiv-2086569323yiv8332450966attach-row {
clear:both;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966attach-table div.ygrps-yiv-2086569323yiv8332450966attach-row div {
float:left;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 p {
clear:both;padding:15px 0 3px 0;overflow:hidden;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966ygrp-file {
width:30px;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966attach-table div.ygrps-yiv-2086569323yiv8332450966attach-row div div a {
text-decoration:none;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966attach-table div.ygrps-yiv-2086569323yiv8332450966attach-row div div span {
font-weight:normal;}
#ygrps-yiv-2086569323 #ygrps-yiv-2086569323yiv8332450966 div.ygrps-yiv-2086569323yiv8332450966ygrp-file-title {
font-weight:bold;}
#ygrps-yiv-2086569323
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select r.AllocatedQty);
decimal sum = PartAllocRows.Sum();
From: "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com>
To: "<vantage@yahoogroups.com>" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 7:04 AM
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vantage/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/vantage/join
(Yahoo! ID required)
<*> To change settings via email:
vantage-digest@yahoogroups.com
vantage-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
vantage-unsubscribe@yahoogroups.com
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
I’ll give it a shot.
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:66f415.png@b734e5cb.41a12c4a]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 7:52 AM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] E10: SQL to LINQ
If you need to add/multiply/subtract fields together in the same row you can do this.
var PartAllocRows = (from r in Db.PartAlloc
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select (r.AllocatedQty - r.PickedQty));
decimal sum = PartAllocRows.Sum();
________________________________
From: "Ted Koch tkoch77@... [vantage]" <vantage@yahoogroups.com>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 7:34 AM
Subject: Re: [Vantage] E10: SQL to LINQ
Try this:
var PartAllocRows = (from r in Db.PartAlloc
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select r.AllocatedQty);
decimal sum = PartAllocRows.Sum();
________________________________
From: "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com>
To: "<vantage@yahoogroups.com>" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 7:04 AM
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com/>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/> <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c<mailto:7e1a63.png@dbbdf9a0.4aadeb7c>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
[Non-text portions of this message have been removed]
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...<mailto:tkoch77@...%3cmailto:tkoch77@...>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...<mailto:tkoch77@...%3cmailto:tkoch77@...>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Jose C Gomez
T: 904.469.1524 mobile
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p>That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...<mailto:tkoch77@...%3cmailto:tkoch77@...>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com%3cmailto:vantage@yahoogroups.com>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...<mailto:jrojas@...%3cmailto:jrojas@...>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
</div> <div style="color:#fff;min-height:0;"></div>
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>%3cmailto:tkoch77@...<mailto:3cmailto%3Atkoch77@...>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com> wrote:Â<div> <p>Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>%3cmailto:tkoch77@...<mailto:3cmailto%3Atkoch77@...>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
</div> <div style="color:#fff;min-height:0;"></div>
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty).DefaultIfEmpty(0)).Sum();
This returned the error:
'decimal' does not contain a definition for 'DefaultIfEmpty' and the best extension method overload 'System.Linq.Queryable.DefaultIfEmpty<TSource>(System.Linq.IQueryable<TSource>, TSource)' has some invalid arguments
Instance argument: cannot convert from 'decimal' to 'System.Linq.IQueryable<int>'
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:6c81fa.png@218dcb8d.468d8edc]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 9:58 AM
To: Vantage
Subject: RE: [Vantage] E10: SQL to LINQ
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@...<mailto:jrojas@...> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524<tel:904.469.1524> mobile
E: jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484><tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>%3cmailto:tkoch77@...<mailto:3cmailto%3Atkoch77@...><mailto:3cmailto%3Atkoch77@...<mailto:3cmailto%253Atkoch77@...>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Jose C Gomez
T: 904.469.1524 mobile
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 10:03 AM, Joe Rojas jrojas@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p>Do you mean something like this?
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty).DefaultIfEmpty(0)).Sum();
This returned the error:
'decimal' does not contain a definition for 'DefaultIfEmpty' and the best extension method overload 'System.Linq.Queryable.DefaultIfEmpty<TSource>(System.Linq.IQueryable<TSource>, TSource)' has some invalid arguments
Instance argument: cannot convert from 'decimal' to 'System.Linq.IQueryable<int>'
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:6c81fa.png@218dcb8d.468d8edc]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 9:58 AM
To: Vantage
Subject: RE: [Vantage] E10: SQL to LINQ
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@…<mailto:jrojas@…> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524<tel:904.469.1524> mobile
E: jose@…<mailto:jose@…><mailto:jose@…<mailto:jose@…>>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@…<mailto:jrojas@…><mailto:jrojas@…<mailto:jrojas@…>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484><tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@…<mailto:tkoch77@…><mailto:tkoch77@…<mailto:tkoch77@…>><mailto:tkoch77@…<mailto:tkoch77@…><mailto:tkoch77@…<mailto:tkoch77@…>><mailto:tkoch77@…<mailto:tkoch77@…><mailto:tkoch77@…<mailto:tkoch77@…>>%3cmailto:tkoch77@…<mailto:3cmailto%3Atkoch77@…><mailto:3cmailto%3Atkoch77@…<mailto:3cmailto%253Atkoch77@…>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
</div><span class="ygrps-yiv-630415582"> <div style="color:#fff;min-height:0;"></div>
You could change your Decimal to a var and check the var for null?
Jose C Gomez
T: 904.469.1524 mobile
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 10:19 AM, Jose Gomez <jose@...> wrote:Yeah that';s what I meant, I would take that first error and google around I am on the road so I can't test it. But ti shouldbe close.On Wed, Nov 5, 2014 at 10:03 AM, Joe Rojas jrojas@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p>Do you mean something like this?
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty).DefaultIfEmpty(0)).Sum();
This returned the error:
'decimal' does not contain a definition for 'DefaultIfEmpty' and the best extension method overload 'System.Linq.Queryable.DefaultIfEmpty<TSource>(System.Linq.IQueryable<TSource>, TSource)' has some invalid arguments
Instance argument: cannot convert from 'decimal' to 'System.Linq.IQueryable<int>'
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:6c81fa.png@218dcb8d.468d8edc]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 9:58 AM
To: Vantage
Subject: RE: [Vantage] E10: SQL to LINQ
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@…<mailto:jrojas@…> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524<tel:904.469.1524> mobile
E: jose@…<mailto:jose@…><mailto:jose@…<mailto:jose@…>>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@…<mailto:jrojas@…><mailto:jrojas@…<mailto:jrojas@…>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484><tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@…<mailto:tkoch77@…><mailto:tkoch77@…<mailto:tkoch77@…>><mailto:tkoch77@…<mailto:tkoch77@…><mailto:tkoch77@…<mailto:tkoch77@…>><mailto:tkoch77@…<mailto:tkoch77@…><mailto:tkoch77@…<mailto:tkoch77@…>>%3cmailto:tkoch77@…<mailto:3cmailto%3Atkoch77@…><mailto:3cmailto%3Atkoch77@…<mailto:3cmailto%253Atkoch77@…>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
</div><span> <div style="color:#fff;min-height:0;"></div>
I found the below to work.
You have to cast the summed up field or expression to a nullable datatype or use “?†to define it as nullable.
Where my variable is not nullable, I used the “??†operator to assign a value if null.
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select x).Sum(c => (decimal?)c.AllocatedQty) ?? -1;
I could also this:
Decimal? myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select x).Sum(c => (decimal?)c.AllocatedQty);
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:da3c1e.png@f7bf44d2.47ba7ba9]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 10:20 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah that';s what I meant, I would take that first error and google around I am on the road so I can't test it. But ti shouldbe close.
Jose C Gomez
Software Engineer
T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 10:03 AM, Joe Rojas jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
Do you mean something like this?
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty).DefaultIfEmpty(0)).Sum();
This returned the error:
'decimal' does not contain a definition for 'DefaultIfEmpty' and the best extension method overload 'System.Linq.Queryable.DefaultIfEmpty<TSource>(System.Linq.IQueryable<TSource>, TSource)' has some invalid arguments
Instance argument: cannot convert from 'decimal' to 'System.Linq.IQueryable<int>'
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:6c81fa.png@218dcb8d.468d8edc]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 9:58 AM
To: Vantage
Subject: RE: [Vantage] E10: SQL to LINQ
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524<tel:904.469.1524><tel:904.469.1524<tel:904.469.1524>> mobile
E: jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>><mailto:jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>>>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484><tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>>%3cmailto:tkoch77@...<mailto:3cmailto%3Atkoch77@...><mailto:3cmailto%3Atkoch77@...<mailto:3cmailto%253Atkoch77@...>><mailto:3cmailto%3Atkoch77@...<mailto:3cmailto%253Atkoch77@...><mailto:3cmailto%253Atkoch77@...<mailto:3cmailto%25253Atkoch77@...>>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:3cmailto%25253Ajrojas@...>>>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:3cmailto%25253Ajrojas@...>>>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>>><cid:8ae0a1.png@6a27c8a6.4694ece3%3cmailto:8ae0a1.png@6a27c8a6.4694ece3%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:3cmailto%25253Ajrojas@...>>>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select r.AllocatedQty);
if (PartAllocRows != null)
{
sum = PartAllocRows.Sum();
}
From: "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 10:25 AM
Subject: RE: [Vantage] E10: SQL to LINQ
After some additional googling.
I found the below to work.
You have to cast the summed up field or expression to a nullable datatype or use “?†to define it as nullable.
Where my variable is not nullable, I used the “??†operator to assign a value if null.
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select x).Sum(c => (decimal?)c.AllocatedQty) ?? -1;
I could also this:
Decimal? myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select x).Sum(c => (decimal?)c.AllocatedQty);
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:da3c1e.png@f7bf44d2.47ba7ba9]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 10:20 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah that';s what I meant, I would take that first error and google around I am on the road so I can't test it. But ti shouldbe close.
Jose C Gomez
Software Engineer
T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 10:03 AM, Joe Rojas jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
Do you mean something like this?
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty).DefaultIfEmpty(0)).Sum();
This returned the error:
'decimal' does not contain a definition for 'DefaultIfEmpty' and the best extension method overload 'System.Linq.Queryable.DefaultIfEmpty<TSource>(System.Linq.IQueryable<TSource>, TSource)' has some invalid arguments
Instance argument: cannot convert from 'decimal' to 'System.Linq.IQueryable<int>'
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:6c81fa.png@218dcb8d.468d8edc]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 9:58 AM
To: Vantage
Subject: RE: [Vantage] E10: SQL to LINQ
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524<tel:904.469.1524><tel:904.469.1524<tel:904.469.1524>> mobile
E: jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>><mailto:jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>>>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> | www.matsinc.com<http://www.matsinc.com><http://www.matsinc.com><http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484><tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>>%3cmailto:tkoch77@...<mailto:3cmailto%3Atkoch77@...><mailto:3cmailto%3Atkoch77@...<mailto:3cmailto%253Atkoch77@...>><mailto:3cmailto%3Atkoch77@...<mailto:3cmailto%253Atkoch77@...><mailto:3cmailto%253Atkoch77@...<mailto:3cmailto%25253Atkoch77@...>>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>%3cmailto:jrojas@...<mailto:3cmailto%3Ajrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3cmailto%253Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:3cmailto%25253Ajrojas@...>>>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>%3cmailto:vantage@yahoogroups.com<mailto:3cmailto%3Avantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3cmailto%253Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:3cmailto%25253Avantage@yahoogroups.com>>>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@matsinc.c
(Message over 64 KB, truncated)
I had seen this example too but for some reason I had it in my head that I wanted to have it all within the single LINQ statement so I pressed forward.
Not that it makes it any better but just because I was curious if it was possible.
Thanks everyone for the input. Definitely learning a lot of LINQ and it’s actually pretty cool.
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:971f81.png@9dc0a0bb.4fa0d7d4]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 05, 2014 10:50 AM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] E10: SQL to LINQ
Like Jose suggested, I think you could have done this too.
decimal sum = 0;
var PartAllocRows = (from r in Db.PartAlloc
where r.Company == callContextClient.CurrentCompany && r.OrderNum == 1 && r.OrderLine == 1 && r.OrderRelNum == 1
select r.AllocatedQty);
if (PartAllocRows != null)
{
sum = PartAllocRows.Sum();
}
________________________________
From: "Joe Rojas jrojas@... [vantage]" <vantage@yahoogroups.com>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Wednesday, November 5, 2014 10:25 AM
Subject: RE: [Vantage] E10: SQL to LINQ
After some additional googling.
I found the below to work.
You have to cast the summed up field or expression to a nullable datatype or use “?†to define it as nullable.
Where my variable is not nullable, I used the “??†operator to assign a value if null.
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select x).Sum(c => (decimal?)c.AllocatedQty) ?? -1;
I could also this:
Decimal? myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select x).Sum(c => (decimal?)c.AllocatedQty);
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:da3c1e.png@f7bf44d2.47ba7ba9<mailto:da3c1e.png@f7bf44d2.47ba7ba9>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>]
Sent: Wednesday, November 05, 2014 10:20 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah that';s what I meant, I would take that first error and google around I am on the road so I can't test it. But ti shouldbe close.
Jose C Gomez
Software Engineer
T: 904.469.1524 mobile
E: jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>>
http://www.josecgomez.com<http://www.josecgomez.com/>
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 10:03 AM, Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> wrote:
Do you mean something like this?
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1 //&& x.OrderLine == 1 && x.OrderRelNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty).DefaultIfEmpty(0)).Sum();
This returned the error:
'decimal' does not contain a definition for 'DefaultIfEmpty' and the best extension method overload 'System.Linq.Queryable.DefaultIfEmpty<TSource>(System.Linq.IQueryable<TSource>, TSource)' has some invalid arguments
Instance argument: cannot convert from 'decimal' to 'System.Linq.IQueryable<int>'
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com/>>
Ask us about our clean, green and beautiful matting and flooring
[cid:6c81fa.png@218dcb8d.468d8edc<mailto:6c81fa.png@218dcb8d.468d8edc>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>]
Sent: Wednesday, November 05, 2014 9:58 AM
To: Vantage
Subject: RE: [Vantage] E10: SQL to LINQ
You may have to move the default inside the SELECT statement
On Nov 5, 2014 9:52 AM, "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>> wrote:
Thanks Jose.
I tried this but I’m getting the error: Unsupported overload used for query operator 'DefaultIfEmpty'.
This is my code:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).DefaultIfEmpty(0).Sum();
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>>
Ask us about our clean, green and beautiful matting and flooring
[cid:cc30b9.png@18bd3308.499bf598<mailto:cc30b9.png@18bd3308.499bf598>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>]
Sent: Wednesday, November 05, 2014 9:42 AM
To: Vantage
Subject: Re: [Vantage] E10: SQL to LINQ
Here you go
Obviously different table, but the concept stands, you do DefaultIfEmpty(0).Sum()
So you'll get 0 if there are none
(from Project_Row in Db.Project where Project_Row.ProjectNumber_c != 0 && Project_Row.Company == Session.CompanyID select Project_Row.ProjectNumber_c).DefaultIfEmpty(0).Max();
Jose C Gomez
Software Engineer
T: 904.469.1524<tel:904.469.1524><tel:904.469.1524<tel:904.469.1524>> mobile
E: jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>><mailto:jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>>><mailto:jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>><mailto:jose@...<mailto:jose@...><mailto:jose@...<mailto:jose@...>>>>
http://www.josecgomez.com<http://www.josecgomez.com/>
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>
Quis custodiet ipsos custodes?
On Wed, Nov 5, 2014 at 9:36 AM, Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>> wrote:
That all for the responds so far.
I did not see that “select Sum(pa.AllocQty) worked. When using LINQPad, it was telling that it didn’t know what “Sum†was.
I did find that this worked:
Decimal myDec = (from x in PartAllocs
where x.OrderNum == 1
select (x.AllocatedQty + x.PickedQty + x.PickingQty)).Sum();
But now my issue is how to deal with a returned value of null.
What I am trying to do is check to see if a particular order has allocations against it.
If it does not, then the LINQ above will return null and null cannot be assigned to Decimal.
I thought I had seen an example where Decimal? was used, where the “?†indicated that it was nullable but this didn’t work in my example.
So my question is, how do I deal with and capture a null value?
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291><tel:781-573-0291<tel:781-573-0291>> | cell: 781-408-9278<tel:781-408-9278><tel:781-408-9278<tel:781-408-9278>> | fax: 781-232-5191<tel:781-232-5191><tel:781-232-5191<tel:781-232-5191>>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>>
Ask us about our clean, green and beautiful matting and flooring
[cid:4b1296.png@94e45d40.44ab3a97<mailto:4b1296.png@94e45d40.44ab3a97>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>]
Sent: Wednesday, November 05, 2014 8:30 AM
To: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>
Subject: RE: [Vantage] E10: SQL to LINQ
Joe –
Here are a couple to try:
var TotalAllocQty = from pa in erp.PartAlloc
where pa.OrderNum == 1 && pa.OrderLine ==1 and pa.OrderRelNum = 1 select Sum(pa.AllocQty);
or
Double TotalAllocQty = erp.PartAlloc.AsEnumerable().Where(x => x.OrderNum == 1 && x.OrderLine == 1 && x.OrderRelNum == 1).Sum(x=>(Double)r[“AllocQtyâ€]);
Hope this helps…
Thank you in advance,
Calvin Dekker
[cid:image011.jpg@01CFF8CA.5382B170<mailto:image011.jpg@01CFF8CA.5382B170>]<http://www.codabears.com/>
630-672-7688 x1484<tel:630-672-7688%20x1484><tel:630-672-7688%20x1484>
[cid:image012.jpg@01CFF8CA.5382B170<mailto:image012.jpg@01CFF8CA.5382B170>] <https://www.facebook.com/CodaBearsInc> [cid:image013.jpg@01CFF8CA.5382B170<mailto:image013.jpg@01CFF8CA.5382B170>] <http://www.linkedin.com/company/codabears-inc> [cid:image014.jpg@01CFF8CA.5382B170<mailto:image014.jpg@01CFF8CA.5382B170>] <https://twitter.com/CodaBearsInc> [cid:image015.png@01CFF8CA.5382B170<mailto:image015.png@01CFF8CA.5382B170>] <http://google.com/+CodaBearsIncRoselle>
From: vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>> [mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>]
Sent: Wednesday, November 5, 2014 6:04 AM
To: <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>>
Subject: Re: [Vantage] E10: SQL to LINQ
Yeah my application of this LINQ would be in a BPM.
I was hoping to find a way to get around having to iterate through all the rows to get a sum of a field.
Sent from my iPhone
On Nov 4, 2014, at 6:30 PM, Ted Koch tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>><mailto:tkoch77@...<mailto:tkoch77@...><mailto:tkoch77@...<mailto:tkoch77@...>>>>%3cmailto:tkoch77@...<mailto:tkoch77@...><mailto:3cmailto%3Atkoch77@...<mailto:3Atkoch77@...>><mailto:3cmailto%3Atkoch77@...<mailto:3Atkoch77@...><mailto:3cmailto%253Atkoch77@...<mailto:253Atkoch77@...>>><mailto:3cmailto%3Atkoch77@...<mailto:3Atkoch77@...><mailto:3cmailto%253Atkoch77@...<mailto:253Atkoch77@...>><mailto:3cmailto%253Atkoch77@...<mailto:253Atkoch77@...><mailto:3cmailto%25253Atkoch77@...<mailto:25253Atkoch77@...>>>>>> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>%3cmailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com><mailto:3cmailto%25253Avantage@yahoogroups.com<mailto:25253Avantage@yahoogroups.com>>>>>>> wrote:
In a BPM?
________________________________
From: "Joe Rojas jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>>%3cmailto:jrojas@...<mailto:jrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...>>><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...>><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...><mailto:3cmailto%25253Ajrojas@...<mailto:25253Ajrojas@...>>>>>> [vantage]" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>%3cmailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com><mailto:3cmailto%25253Avantage@yahoogroups.com<mailto:25253Avantage@yahoogroups.com>>>>>>>
To: "vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>%3cmailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com><mailto:3cmailto%25253Avantage@yahoogroups.com<mailto:25253Avantage@yahoogroups.com>>>>%3e>" <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>>>>%3cmailto:vantage@yahoogroups.com<mailto:vantage@yahoogroups.com><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>>><mailto:3cmailto%3Avantage@yahoogroups.com<mailto:3Avantage@yahoogroups.com><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com>><mailto:3cmailto%253Avantage@yahoogroups.com<mailto:253Avantage@yahoogroups.com><mailto:3cmailto%25253Avantage@yahoogroups.com<mailto:25253Avantage@yahoogroups.com>>>>>>>
Sent: Tuesday, November 4, 2014 5:05 PM
Subject: [Vantage] E10: SQL to LINQ
Hello,
Is it possible to represent this SQL Statement in LINQ?
SELECT SUM(AllocatedQty) AS TotalAllocQty
FROM Erp.PartAlloc
WHERE OrderNum = 1 AND OrderLine = 1 AND OrderRelNum =1;
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291><tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>>%3cmailto:jrojas@...<mailto:jrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...>>><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...>><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...><mailto:3cmailto%25253Ajrojas@...<mailto:25253Ajrojas@...>>>>>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/><http://www.matsinc.com%3chttp:/www.matsinc.com<http://www.matsinc.com%3chttp/www.matsinc.com><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>>>>
Ask us about our clean, green and beautiful matting and flooring
[cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3><mailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>>>>><cid:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>%3cmailto:8ae0a1.png@6a27c8a6.4694ece3<mailto:8ae0a1.png@6a27c8a6.4694ece3>%3e>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>>%3cmailto:jrojas@...<mailto:jrojas@...><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...>><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...>>><mailto:3cmailto%3Ajrojas@...<mailto:3Ajrojas@...><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...>><mailto:3cmailto%253Ajrojas@...<mailto:253Ajrojas@...><mailto:3cmailto%25253Ajrojas@...<mailto:25253Ajrojas@...>>>>>>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/> <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>><mailto:jrojas@...<mailto:jrojas@...><mailto:jrojas@...<mailto:jrojas@...>>>>> | www.matsinc.com<http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>><http://www.matsinc.com<http://www.matsinc.com/>>
Ask us about our clean, green and beautiful matting and flooring
[cid:7e1a63.png@dbbdf9a0.4aadeb7c<mailto:7e1a63.png@dbbdf9a0.4aadeb7c>]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Joe Rojas <jrojas@...<mailto:jrojas@...>>
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/. <http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
------------------------------------
Yahoo Groups Links
[Non-text portions of this message have been removed]











