Showing posts with label Office 365. Show all posts
Showing posts with label Office 365. Show all posts

Wednesday, 2 September 2015

Create a report or a scorecard (SharePoint Server 2013)

By using SharePoint Server 2013, you can create, share, or access a variety of reports, scorecards, and dashboards that are stored in a central location, such as a Business Intelligence Center site.
NOTE   The information in this article applies to on-premises environments. It does not pertain to Office 365. If you're looking for information about BI in Office 365, see Business intelligence capabilities in Excel and Office 365 .

How do I create a report or a scorecard?

Depending on how your environment is configured, you can typically have a variety of tools available to create and publish business intelligence (BI) content. For example, you’ll typically have Excel Services and Visio Services available to use. You might also have PerformancePoint Services available to create, publish, and share reports, scorecards, and dashboards in your organization.
To create a report or a scorecard, you would typically take the following steps:
  1. Determine what information you want to show in the report or scorecard.
  2. Identify the data sources that you want to use. Make sure that you (and those who will be using the report or scorecard) will have access to the data.
    You might want to contact a SharePoint administrator for help with data sources and user permissions.
  3. Choose the report creation tool that you want to use.
    You can choose from a variety of tools, including Excel, PerformancePoint Dashboard Designer, Visio, and more.
  4. Create the report, and save it to a site such as a Business Intelligence Center site.
    See What is a Business Intelligence Center? for more information.

What tools can I use to create reports?

You can choose from a variety of tools to create reports, scorecards, and dashboards that you can publish to a SharePoint site.
Application
Capabilities

Excel and Excel Services
Excel 2013 makes it easier than ever to create reports, scorecards, and dashboards. You can connect to a wide variety of data sources and then create a variety of charts and tables. You can add filters, such as slicers and timeline controls to worksheets, and use features such as Quick Explore to see additional information about a particular value in a report.
If Excel Services is configured in your environment, then you can publish workbooks that can be displayed in a browser window. Depending on the data sources that are used, people can refresh the data to view the most current information.

PowerPivot
PowerPivot in Excel enables you to create large, multi-table data models that can have complex relationships and hierarchies.

Power View
Power View in Excel enables you to create mash-ups and presentation-ready, interactive dashboards. Power View views use tabular data sources, such as a Data Model that you can create in Excel.

PerformancePoint Dashboard Designer
If your organization is using SharePoint Server 2013 on premises, then you might have PerformancePoint Services configured and available for you to use.
PerformancePoint Dashboard Designer enables you to create dashboards that bring together a variety of reports, including PerformancePoint scorecards and reports, Excel Services reports, and SQL Server Reporting Services reports, in a single location. You can create powerful scorecards that contain advanced key performance indicators (KPIs) and add dashboard filters that can reused across multiple pages in a dashboard and across multiple dashboards.

Visio and Visio Services
Visio makes it easy to create data-connected diagrams, such as network infrastructure diagrams, organization charts, floor plans, and so on.
If Visio Services is configured, then you can publish Visio drawings to SharePoint Server where they can be shared in a central location such as a Business Intelligence Center site.

SQL Server Reporting Services
Reporting Services makes it possible to create and share a wide range of powerful reports, including interactive maps, bubble charts, gauges, tables, and other views. Reporting Services report creation tools include Power View (launched from SharePoint Server), Report Designer, and Report Builder.

Business Intelligence for SharePoint Online

BI capabilities in Power BI for Office 365, Excel, and SharePoint Online

NOTE    The information in this article applies to Excel 2013 and SharePoint Online in Office 365 Enterprise.  Business intelligence capabilities are not supported in Office 365 operated by 21Vianet.
Excel, SharePoint, and Power BI
Business intelligence (BI) is essentially the set of tools and processes that people use to gather data, turn it into meaningful information, and then make better decisions. In Office 365 Enterprise, you have BI capabilities available in Excel, SharePoint Online, and Power BI for Office 365. These services enable you to gather data, visualize data, and share information with people in your organization across multiple devices.

What do you want to do?


Use Excel to gather and visualize data


Step 1: Get data


Step 2: Visualize data


Step 3: Add filters


Step 4: Add advanced analytic capabilities

Use SharePoint Online to share and view workbooks


Use Power BI for Office 365 to access more BI capabilities in the cloud


Learn more about BI in Office and SharePoint

Use Excel to gather and visualize data

In just a few simple steps, you can create charts and tables in Excel.
Example of an Excel Services dashboard

Step 1: Get data

In Excel, you have lots of options to get and organize data:
  • You can connect to a variety of data sources in Excel and use it to create charts, tables, and reports.
  • Using Power Query, you can discover and combine data from different sources, and shape the data to suit your needs.
  • You can create a Data Model in Excel that contains one or more tables of data from a variety of data sources. If you bring in two or more tables from different databases, you can create relationships between tables by using Power Pivot.
  • In a table of data, you can use Flash Fill to format columns to display a particular way.
  • And, if you’re an advanced user, you can set up calculated items in Excel.

Step 2: Visualize data

Once you have data in Excel, you can easily create reports:
  • You can use Quick Analysis to select data and instantly see different ways to visualize that data.
  • You can create lots of charts that include tables, line charts, bar charts, radar charts, and so on.
  • You can create PivotTables and drill into data by using Quick Explore. You can also use the Field List for a report to determine what information to display.
  • You can create scorecards that use conditional formatting and Key Performance Indicators (KPIs) in Power Pivotto show at a glance whether performance is on or off target for one or more metrics.
  • You can create compelling, interactive visualizations using Power View.
  • You can create interactive maps using Power View, or you can use Power Map to analyze and map data on a three-dimensional (3D) globe.

Step 3: Add filters

You can add filters, such as slicers and timeline controls to worksheets to make it easier to focus on more specific information.

Step 4: Add advanced analytic capabilities

When you’re ready, you can add more advanced capabilities to your workbooks. For example, you can createcalculated items in Excel. These include:
  • Calculated Measures and Members for PivotChart or PivotTable reports
  • Calculated Fields for data models

Use SharePoint Online to share and view workbooks

If your organization is using team sites, you’re using SharePoint Online, which gives you lots of options to share workbooks. You can specify Browser View Options that determine how your workbook will be displayed.
You can display workbooks in gallery view like this, where one item at a time is featured in the center of the screen:
Sample workbook displayed in gallery view
You can display workbooks in worksheet view, like this, where a whole worksheet is displayed in the browser:
Sample workbook displayed in worksheet view
And, you can even display an item or a worksheet in a special container that is called the Excel Web Access Web Part, like this:
Sample workbook displayed in an Excel Web Access Web Part
When a workbook has been uploaded to a library in SharePoint Online, you and others can easily view and interact with the workbook in a browser window.

Use Power BI for Office 365 to access more BI capabilities in the cloud

Power BI for Office 365 gives you even more BI capabilities than what you get in Excel and SharePoint Online. Power BI for Office 365 provides you with a robust, self-service BI solution in the cloud.
Power BI mobile app home page
Key features include:
  • Support for larger workbooks. Power BI for Office 365 can support workbooks up to 250 MB, provided the workbooks are configured a certain way.
  • Power BI Q&A, which enables you to ask questions and get answers using natural language queries.
  • Power BI sites on Power BI for Office 365, which enables you to transform a basic SharePoint site into a visual, dynamic way to view and share Excel workbooks with others. Workbooks are displayed in thumbnail images so it’s easy for people to see and select the workbooks they want to use.
  • Power BI Windows Store app, which is an application that is available in the Windows Store. You can use Power BI app to view and interact with Excel workbooks on a Windows tablet.
These are just some of the powerful new BI capabilities that are available in Power BI for Office 365. For more information, see Power BI for Office 365.


Monday, 31 August 2015

REST API in SharePoint 2013

REST service for list was first introduced in SharePoint 2010. It was under the end point /_vti_bin/listdata.svc and it still works in SharePoint 2013. SharePoint 2013 introduces another endpoint /_api/web/lists and which is much more powerful than in SharePoint 2010. The main advantage of REST in SharePoint 2013 is: we can access data by using any technology that supports REST web request and Open Data Protocol (OData) syntax. That means you can do everything just making HTTP requests to the dedicated endpoints. Available HTTP methods are GET, POST, PUT, MERGE, and PATCH. Data format supported by the HTTP methods is ATOM (XML based) or JSON.

READ: HTTP GET method is used for any kinds of read operation.

CREATE: Any kind of create operation like list, list item, site and so on maps to the HTTP POST method. You have to specify the data in request body and that’s all. For non-required columns, if you do not specify the values, then they will be set to their default values. Another important thing is: you cannot set value to the read-only fields. If you do so, then you will get an exception.

UPDATE: For updating existing SharePoint 2013 objects, there are three HTTP methods like PUT, PATCH and MERGE available. The recommended methods are PATCH and MERGE. PUT requires the entire huge object to perform update operation. Let's say we have a list named EMPLOYEE and it has 100+ fields and we want to update EmployeeName field only. In this case, if we use PUT method, we must have to specify the value of others fields alone with EmployeeName field. But PATCH and MERGE are very easy. We just have to specify the value of EmployeeName filed only.

DELETE: HTTP DELETE method is used to delete any objects in SharePoint 2013

For accessing SharePoint resources by using REST API, at first we have to find the appropriate endpoints. The following table demonstrates the endpoints associated with CRUD operation in a list.
function getItems(url) {
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
        },
        success: function (data) {
            console.log(data.d.results);
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });
}




In the above _spPageContextInfo.webAbsoluteUrl may be quite new to you. Actually, it returns the site url and it’s the preferred way rather typing it hard coded. Now it’s time to constructs some urls and call the above method.

Getting All Items from SpTutorial

If we go through the REST endpoints table again, the endpoint (constructed url) should look like the following.
var urlForAllItems = "/_api/Web/Lists/GetByTitle('SpTutorial')/Items";
Call the method getItems(urlForAllItems);
In the data.d.results, you will find fields internal names as object’s property. In the above example, we will get only the Id of Lookup and Person type column. But we need more information about these columns in ourJSON results. To nail this, we have to learn some OData query string operators.
$select specifies which fields to return in JSON results.
$expand helps to retrieve information from Lookup columns.
Now if we re-write the urlForAllItems, it should look like the following:
var urlForAllItems = 
               "/_api/Web/Lists/GetByTitle('SpTutorial')/Items?"+
               "$select=ID,Title,SpMultiline,SpChoice,SpNumber,SpCurrency,SpDateTime,SpCheckBox,SpUrl,"+
                "SpPerson/Name,SpPerson/Title,SpLookup/Title, SpLookup/ID" +
                "&$expand=SpLookup,SpPerson";
To use $expand alone with $select, you have to specify the column names in $select just what I did in the above like SpLookup/Title, SpLookup/ID.
$filter specifies which items to return. If I want to get the items where Title of SpTutorial equals to‘first tutorial’ and ID of SpTutorialParent equals to 1, the URL should look like the following:
var urlForFilteredItems = 
               "/_api/Web/Lists/GetByTitle('SpTutorial')/Items?"+
               "$select=ID,Title,SpMultiline,SpChoice,SpNumber,SpCurrency,SpDateTime,SpCheckBox,SpUrl,"+
               "SpPerson/Name,SpPerson/Title,SpLookup/Title,SpLookup/ID"+
               "&$expand=SpLookup,SpPerson&$filter=Title eq 'first tutorial' and SpLookup/ID eq 1";
You may notice that I have used a query operator like ‘eq’ in above URL. Now let’s see what are the other query operators available.
NumericStringDate Time functions
Lt (less than)startsWith (if starts with some string value)day()
Le (less than or equal)substringof ( if contains any sub string)month()
Gt (greater than)year()
Ge (greater than or equal)hour()
Eq (equal to)Eqminute()
Ne (not equal to)Nesecond()
Note: Unfortunately, date time functions do not work with new style (URL) of SharePoint 2013. But there is a hope we can do it like SharePoint 2010 style.
var filterByMonth = "/_vti_bin/listdata.svc/SpTutorial?$filter=month(SpDateTime) eq 6";
$orderby is used to sort items. Multiples fields are allowed separate by comma. Ascending or descending order can be specified just by appending the asc or desc keyword to query.
var urlForOrderBy = "/_api/Web/Lists/GetByTitle('SpTutorial')/Items?" +
    "$select=ID,Title,SpMultiline,SpChoice,SpNumber,SpCurrency,SpDateTime,SpCheckBox,SpUrl," +
    "SpPerson/Name,SpPerson/Title,SpLookup/Title,SpLookup/ID" +
    "&$expand=SpLookup,SpPerson&$orderby=ID desc";
$top is used to apply paging in items.
var urlForPaging = "/_api/Web/Lists/GetByTitle('SpTutorial')/Items?$top=2";
Adding New item: In this case, our HTTP method will be POST. So write a method for it.
function addNewItem(url, data) {
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "POST",
        headers: {
            "accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "content-Type": "application/json;odata=verbose"
        },
        data: JSON.stringify(data),
        success: function (data) {
            console.log(data);
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });
}
In header, you have to specify the value of X-RequestDigest. It’s a hidden field inside the page, you can achieve its value by the above mentioned way ($("#__REQUESTDIGEST").val()). But sometimes, it does not work. So the appropriate approach is to get it from /_api/contextinfo. For this, you have to send aHTTP POSTrequest to this URL (_api/contextinfo) and it will return X-RequestDigest value (in the JSON result, its name should be FormDigestValue).
URL and request body will be like the following for adding new item in list.
var addNewItemUrl = "/_api/Web/Lists/GetByTitle('SpTutorial')/Items"; 
var data = {
    __metadata: { 'type': 'SP.Data.SpTutorialListItem' },
    Title: 'Some title',
    SpMultiline: 'Put here some multiline text. You can add here some rich text also',
    SpChoice: 'Choice 3',
    SpNumber: 5,
    SpCurrency: 34,
    SpDateTime: new Date().toISOString(),
    SpCheckBox: true,
    SpUrl: {
        __metadata: { "type": "SP.FieldUrlValue" },
        Url: "http://test.com",
        Description: "Url Description"
    },
    SpPersonId: 3,
    SpLookupId: 2
};
Note: Properties of data are the internal name of the fields. We can get it from following URL by making aHTTP GET request.
var urlForFieldsInternalName = "/_api/Web/Lists/GetByTitle('SpTutorial')/
Fields?$select=Title,InternalName&$filter=ReadOnlyField eq false";
TypeValue
Single line of textString
Multiple lines of textMultiple lines can be added here also rich text
ChoiceString but it must come from choices available in the list.
NumberInteger or double
CurrencyLike number
Date and TimeString but it must be ISOString format
LookupInteger and must be the ID of Lookup item
Yes/Notrue or false
Person or GroupInteger and must be the ID of Person or Group
Hyperlink or PictureObject that has three properties only like__metadataUrlDescription
Inserting multiple values to person or group column, we have to specify the ids of people or group.
var data = {
    __metadata: { "type": "SP.Data.TestListItem" },
    Title: "Some title",
    MultiplePersonId: { 'results': [11,22] } 
}
N.B.: This is an update based on user comment.
How to specify the value of __metadata for new list item? Actually, it looks like the following.
__metadata: {'type': 'SP.Data.' + 'Internal Name of the list' + 'ListItem'}
Updating Item: We can use the following method for updating an item.
function updateItem(url, oldItem, newItem) {
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "PATCH",
        headers: {
            "accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "content-Type": "application/json;odata=verbose",
            "X-Http-Method": "PATCH",
            "If-Match": oldItem.__metadata.etag
        },
        data: JSON.stringify(newItem),
        success: function (data) {
            console.log(data);
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });
}
Then can get your old item, modify it and construct the URL.
var updateItemUrl = "/_api/Web/Lists/GetByTitle('SpTutorial')/
getItemById('Id of old item')";
Something has been changed as compared to add new item. Let me explain one by one. Now HTTP method isPATCH and it is also specified in header ("X-Http-Method": "PATCH") and which is recommended I mentioned earlier.
etag means Entity Tag which is always returned during HTTP GET itemsYou have to specify etag value while making any update or delete request so that SharePoint can identify if the item has changed since it was requested. Following are the ways to specify etag.
  1. "If-Match": oldItem.__metadata.etag (If etag value does not match, service will return an exception)
  2. "If-Match": "*" (It is considered when force update or delete is needed)

Deleting Item

It’s very simple. Just the following method can do everything.
function deleteItem(url, oldItem) {
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "DELETE",
        headers: {
            "accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "If-Match": oldItem.__metadata.etag
        },
        success: function (data) {
           
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });
}
URL is the same as updating item. It will not return anything when operation is successful. But if any error happens, then it will return an exception.