STIRNG_SPLIT function not working in SSRS DataSet - tsql

In SSRS DataSet I am trying to pull data using STRING_SPLIT function.
Please refer to below code:
SELECT StudentName
FROM Student
WHERE StudentId IN (SELECT VALUE FROM STRING.SPLIT(#StudentId,','))
#StudentId is a multi select parameter.
Error message: Invalid object name 'dbo.STRING_SPLIT'

In SSRS if your parameter is multi value. It is already considered as an array. You should be able to just do this to select the Student Names where the id is in the parameter list.
SELECT StudentName
FROM Student
WHERE StudentId IN (#StudentId)
You are basically saying from the student ID's I selected in the report parameter find me those peoples names and give me the list.

Related

Powershell CSOM - to update Project Department look-up field Value

I wanted to update Project Department Ent Custom Field value, which is of type look-up field- ... from a csv file via/using powershell /csom.
Many projects have department field to be updated/modified & I am looking to do this by some powershell script.
But I have no luck to push Dept value from csv into project server Field (Project Department)
[Array]$MyArray1 = $_.Dept
$draftProject.SetCustomFieldValue($Dept,$MyArray1)
Ref - https://gallery.technet.microsoft.com/projectserver/Update-Server-Custom-Field-00ab99a9
Appreciate any idea ...
Thanks
go to pwaurl/pwa/_api/ProjectServer/CustomFields
then search for Project Department
You are looking for its internalName
usually like: custom_Guid.
Project department needs to be passed as an array, with text values replaced with their guid
The Q & A section of the referenced TechNet gallery project contains a similar question and the author himself answers:
For lookup fields (Either multi-select or not), you can only pass the
Lookup value as an array (The array value must be the MemberValue GUID
from the Lookup table in DB.
This should do the trick.

How to perform conditional de-duplication in talend

I have a table with the employee ID, name, and last effective date. I want to keep only the employee ID with max(last effective date) and discard the other duplicate employee id rows that have an earlier last effective date.
I am trying to implement this usingtAggregate and tFilterRow. I attemped to perform count using tAggregate but it does not capture max(lasteffectivedate).
With a tAggreggateRow you can do :
If you want to get the ID too you need to reuse your primary flow in tMap (Main branch) and put the flow with the tAggregateRow in the lookup of the tMap.
After that you do a join on name AND date.

SharePoint 2013 REST How to select a look up field and also filter based on look up field?

I can't select look up field in my SharePoint 2013 List.
also I can't filter base on a Look up field.
for example I have List with Name Test and this list has fields: Title, Company, Province
the Company and Province is look up fields I want to filter based on Province which is a look up field
using REST query it gives error:
my query:
https://TestServer/sites/AIB/OBC/_api/web/lists/getByTitle('Test')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq 'ABC'
it gives error when I put the URL in My browser for testing it gives the blow error:
<m:message xml:lang="en-US">The field or property 'Province' does not exist.</m:message>
How to filter based on a look up field in SharePoint 2013 REST ?
How to filter by lookup field value using SharePoint REST
Assume a Contacts list that contains a lookup field named Province
Option 1
When a lookup column is being added into list, its ID become accessible automatically via REST. For example, when the field named Province is added into List, Province Id could be set or get via ProvinceId property of List Item.
The following query demonstrate how to filter list items by lookup field Id (Province Id in our case):
/_api/web/lists/GetByTitle('<list title>')/items?$filter=LookupField eq <ProvinceId>
where <ProvinceId> is a province id
Option 2
In order to filter by lookup value, the query should contain $expand query option to retrieve projected fields (like Province Title). The following example demonstrates how to filter by lookup field value (by Province Title in our case):
/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq <ProvinceTitle>
where <ProvinceTitle> is a Title of Province
Use $expand like blow code:
/_api/web/lists/GetByTitle('Test')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq 'XYZ'
Mehdi jalal, I found why it was throwing that error. You need to close your ProvinceTitle with Single Quotes and there you have it. like this
Query Syntax:
/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title,Province/ID&$expand=Province&$filter=Province/Title eq '<ProvinceTitle>'
Now this is Example Query:
/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title,Province/ID&$expand=Province&$filter=Province/Title eq 'Detroit Province'

Can the with function be used with a GroupBy clause in Laravel Eloquent?

Can the with function be used with a GroupBy clause in Laravel Eloquent? Does it serve any purpose if I have specific items to select using the Select Clause?
Following is the query that I currently have
Order::with('Campaign')
->where('isapproved','=','Y')
->groupBy('campaign_id')
->orderBy(DB::raw('COUNT(id)','desc'))
->get(array(DB::raw('COUNT(id) as totalsales')));
The order table has a column name campaign_id which belongsTo the table named campaigns. I would like to get the total count of the sales from the order table against each campaign and need to show in the following manner.
Total Sales Campaign
-------------------------
200 Campaign1
500 Campaign2
300 Campaign3
Should I have to perform a specific select or can I access the values of the Campaign table from the above query?
If the referenced column required by the Model specified on the With function is retrieved in the SELECT clause, then the With function is taken into consideration by the above query. The rectified query will be
$groupedSalesCampaign = Order::with('Campaign')
->where('isapproved','=','Y')
->groupBy('campaign_id')
->orderBy(DB::raw('COUNT(id)','desc'))
->get(array(DB::raw('COUNT(id) as totalsales'),'campaign_id'));
This way the Campaign information can be retrieved using
foreach($groupedSalesCampaign as $campaign)
{
Log::info($campaign->foo->bar);
}
Edited.

Filemaker - Summing a field based on another field

In Filemaker Pro 12, I am trying to write a formula for a calculation field that will sum a field in a related table based on another field in that same related table. The normal Filemaker sum equation would look like this:
Sum (Assets::Asset Quantity)
However, I need to specify that only quantities that are related to a field named Asset Type with a value of "Building" will be used to filter the values in Asset Quantity that will be used in the sum.
There are a couple of ways that you could do this:
A new Calculated field
First, you could add a new Calculation field to your Assets table called, say, Building Quantity, with a Calculated Value of:
If (Asset Type = "Building" ; Asset Quantity ; 0)
And then you can use the sum of this new Building Quantity just like you were using Sum(Assets::Asset Quantity) before.
A new relationship
Second, you could add a new Calculated field to your main table with the value always equal to "Building" and then add a new table occurrence of the Assets table. We'll call it "BuildingAssets" and set the relationship so that your IDs match and also your new "Building" field matches the Asset Type
Summary ID \____________/ BuildingAssets::Summary ID
BuildingText / \ BuildingAssets::Asset Type
Then you will use
Sum (BuildingAssets::Asset Quantity)
instead of Sum (Assets::Asset Quantity) so that you only pull the Building types through.
ExecuteSQL
Finally, FileMaker 12 introduced the ExecuteSQL step. This may be the most elegant way to do the above because it doesn't involve changing any schema. The statement would be somethign like:
SELECT
SUM (Asset Quantity)
FROM
Assets
WHERE
Summary ID = ID AND
Asset Type = Building
For more information check out FileMaker's page: http://www.filemaker.com/12help/html/func_ref3.33.6.html
Also check out the FileMaker SQL Sugar ("#") Module for help building queries: http://www.modularfilemaker.org/2013/03/filemaker-sql-sugar/