How to get Cube Data Source View Last Schema Update value - c#

SQL Server Analysis Services
Is there a way to get the data source view last schema update value as seen on the properties dialog box?
If I use the DMV syntax:
SELECT * FROM $System.MDSCHEMA_CUBES
It will list all the measures and dimensions used in the cube database which shows details the same as right clicking the measure or dimension and selecting properties. But, this query does not include the properties for data source or data source view.
Thanks in advance!
Regards and Thanks,
Willie P
P.S. The main reason why I need to get the Last Schema Update for data source view, measures and dimension is to determine if a particular cube element was customized/modified by the client so that if we have to deploy an update to the cube, we have an option to update a particular cube element or not just by getting the Last Schema Update.
If this is not possible using SSAS DMV's, maybe a C# sample program will do.

Related

Blazor Server Side - Load more 50 data

Good Day Everyone
I'm creating a Blazor Server Side application with card style on my home page, I did not use javascript on loading those data, it's just simple razor and c#. Now it loads almost 2000+ data, this makes my app slow, so what I want to do is to load 50 data first, then there is a load more below that will load 50 data, my idea is to insert the 50 on the object where the first 50 is, but I think this will also cause a bulk on the data projected on the page, and it might cause a problem if it reaches a 3000+, is there a way to do this on the Blazor Server-Side?
Thanks and regards
Blazor does not have built-in pagination. You'll have to do that yourself in your C# code that sends the data to your frontend/razor component(s). There are Blazor frameworks that can handle that for you, of course (Google for MudBlazor or Radzen).
You can either create your own logic to load more results on each click of a button (not really hard to manage that with a SQL query).
Or you can try component virtualization, which I suspect is the closest built-in option to what you want:
https://learn.microsoft.com/en-us/aspnet/core/blazor/components/virtualization?view=aspnetcore-6.0
Edit Note:
I just noticed Bennyboy1973 mentioned this.
I suppose I just expounded on it for no reason, haha.
I know this is an old question, but for anyone else who may stumble across this problem.
Blazor has a "Virtualize" component that you can make use of. Simply put, it only renders and displays records that would be visible on screen. As you scroll in the list, it would then render the next set of records and so on, freeing up the resources that would normally be used rendering the full dataset.
To compliment the "Virtualize" component, Blazor has a ItemsProvider delegate method which you can make use of; allowing you to set it up so that instead of loading the full 2000+ record set, it only loads the amount of records needed for the current viewspace of your app. Then like the Virtualize, as you scroll it will query your dataset for the next X amount of records and then render them, and so on.
Setting up the initial "Virtualize" component is easy:
Let's say you load your cards as below
<div style="height:800px; overflow-y:scroll">
#foreach (var card in allCardDetails)
{
<MyCard #key="card.Id" Title="#card.Title" Details="#card.Details" />
}
</div>
What this will result in, is all Cards being rendered for all data records. (This includes rendering of Cards that aren't even visible onscreen.)
To implement the Virtualize component, you simply change up the code snippet to resemble the following
<div style="height:800px; overflow-y:scroll">
<Virtualize Items="#allCardDetails" Context="card">
<MyCard #key="card.Id" Title="card.Title" Details="#card.Details" />
</Virtualize>
</div>
Now, only the Cards that would be visible within the region of the DIV will be rendered, and as you scroll down in the DIV it will proceed to render the next Cards that would be visible and so on.
This would greatly aid in screen jittering or rendering (The lag). If you want to take it a step further, to limit the amount of data that is queried from your server at initial load, you can make use of the ItemsProvider delegate method to achieve this.
Virtualize with ItemsProvider:
<div style="height:800px; overflow-y:scroll">
<Virtualize Context="card" ItemsProvider="#loadCardDetails">
<MyCard #key="card.Id" Title="card.Title" Details="#card.Details" />
</Virtualize>
</div>
We've removed the Items field, and replaced it with the ItemsProvider as the Datasource is now mutable; determined by the ItemsProvider. Lastly, we need to create the ItemsProvider method (in this case called "loadCardDetails") which will dynamically load the records as they are needed.
private async ValueTask<ItemsProviderResult<CardDetails>> loadCardDetails(ItemsProviderRequest request)
{
//It would be a good idea, at page load, to get a count of all records and
//and store in an accessible variable.
//For the sake of this example, I'll include it here.
var totalCount = DbContext.CardDetails.Count();
//This portion, determines how many records need to be loaded next
//Math.Min is used to ensure that we don't try to load more records than
//is available.
//Eg. We have 50 records, but Vitualize is requesting 60 records (more than
//we have) instead it will only attempt to get the 50 we have and return it
var numCardDeets = Math.Min(request.Count, totalCount - request.StartIndex);
//This portion get's the next set of data records to the count of our
//"numCardDeets" value.
var results = DbContext.CardDetails.Skip(request.StartIndex).Take(numCardDeets);
//Finally, it returns the result set to the Virtualize component to render.
return new ItemsProviderResult<CardDetails>(results, totalCount);
}
And that's it. If all is setup correctly, the Virtualize component will now only load the Data that would fit on your screen (from your datasource) and render it; then as you scroll down it loads the next set of Data, and renders it.
This example is made under the assumption you make use of EntityFramework to retrieve data from a database. The implementation of how you get the Data from your datasource will vary depending on what or where your datasource is.
I'll just note here:
request.StartIndex and request.Count are managed by the ItemsProvider; it keeps track of it's own current index and request number (number of records being requested)

How to generate freeform rdlc reports with one page per row

Given a data set containing multiple rows, from within a .NET console application I need to generate a report on a single page for each row, sending those pages directly to the printer.
I am attempting to use Microsoft Report for this by attaching it to a data set and placing TextBoxes where I wish. Generating the report and sending it to the printer are not a problem. Unfortunately, the data only seems to be available in aggregates -- First, Sum, Last, Max, etc. I cannot latch the text box to a bare field.
Some poking around here and other sites seems to address this, but only when the data is presented in a table. One post even said without elaboration, "My mistake was using Text Boxes"
Am I using the wrong tool for what I am attempting to accomplish?
I ran into the same problem and managed to solve it. The solution seems a little convoluted to me so don't quote me on the "right" way to do this, but here is what I did:
Make sure you have a Dataset defined for your report.
Add a "Table" control to the report. This seems to be needed in order to iterate the rows in your Dataset.
Delete the header row and two of the default columns from the table so that you are left with a single row with a single column.
Expand the table to the width of your layout and make it as tall as you will need for your "free form" layout.
By default, there is a TextBox inside the table cell. Right-click the empty table cell and choose "delete" to remove that TextBox.
Drag a "Rectangle" control into the empty table cell. It seems to automatically "dock" to the width/height of the table cell.
Now you should be able to drag the fields from your DataSet (TextBoxes, etc) into the Rectangle to produce the desired layout.
Note that I am in the early stages of using this approach so I'm not sure if I am going to hit any walls... but for a basic report that uses TextBoxes and a page break after each "row" it seems to be working ok.
Or you try to use a list.
In the list you can arange textboxes (and other controls) as you want and they will be filled for each record in the recordset.
This work for me. :-)

Using report viewer, how do I pull from two seperate Datasets

I have two datasets I need to pull from, A base that both reports use and then a separate one that only one report pulls from. I get the error
Error 12 The Value expression for the text box ‘Textbox9’ refers to
the field ‘Name’. Report item expressions can only refer to fields
within the current dataset scope or, if inside an aggregate, the
specified dataset scope.
My best guess is I have to associate them with the correct dataset but I have not been able to find any documentation on this.
edit: I am trying to access property files that I created for the fields on the report document.
Can someone please tell me where in the rdlc document I need to code something like name.value, "dataset1" or something similar?
When you create a table in a RLDC, in the Tablix properties (selecting a row or a column) you must associate a DataSet.
After doing that, you have to write in each cell the name of the field (in the dataset) that you will use. You can do that by clicking on the "little table" in the cell, when you put the mouse over it
In images (with Visual Studio 2010)
If you don't see the dataset in the list, you must add it.
For that, click on view menu -> report data.
Then, in the DummyDataSource, click Add Dataset..
And select it from the list, or create a new one instead, in the same form.
If this doesn't work, well I don't know haha
If the two datasets has the same structure, then you could use one just, and in the code assign it to the datasource
I ran into this same error and the only way I could resolve it was by closing and reopening BIDS and then refreshing the fields from the stored procedure (Right click the data set -> Dataset Propoerties -> Query -> Refresh Fields).
Thanks for the troubleshooting tips!
If you are trying to embed the results of one set into a table that is using another data set, have you considered a subreport?
After some careful research and error checking I found that I had to create my base model property file and when I drag the actual data points on to my form I had to associate them with their correct set:
I clicked the value and associated the correct dataset.

Lightswitch XtraReport chart - reducing number of points / accessing dataSource

I have an XtraReport with 6 charts containing 4-8 LineSeries, where each Series can have up to 25,000 Points. The data comes from a query from a database table.
The problem is, that it takes around 3 minutes to draw the report which is too long for us.
So we need to reduce the number of points (which I already did in another case, so I know how to do that).
But where is the "right place" to perform this reducing action? Within the screen where the ReportPreview control is located and passing a new Collection (with all the series) as Parameter to the report? Is it possible to use such an custom Object as Parameter?
Or should I first load the database table inside the report and then reduce it?
How can I access the Datasource within the XtraReport by code?
And how can I tell my chart components to select my Collection as dataSource and not the database query result?
Also any other ways to improve the performance of XtraReports & charts.
Thanks.
EDIT
We created a SQL View which reduced the number of points and also used some code in the Preprocess_query methode with LINQ to use only needed points.

Crystal Report Making on the basis of Number of Selected Attributes from check list, how can we do so?

I am developing application in C# Windows Forms, i make crystal reports on the basis of data collection list in c#, for example i have a table having EmpID, Name, Sponsor, Job Title, Nationality etc. I bring them in collection in c# and pass it to crystal report, where i see my attributes in Database fields, if i drag and drop those fields on the report, for example Name, Job Title, Nationality, then i can see their columns coming in Details section, but the issue is, i have about 25 attributes and i have made a check list of 25 attributes in c#, if i check 13 attributes, it should make a report of 13 columns, the problem is, we make report in crystal report on the basis of drag and dropping fields, how can i dynamically do this, means if there are 13 fields selected in c# check list, there should be just 13 columns in report. Please find the image attached, "How currently i am doing" Please zoom it by right click on it, and open in new window.
I think that the easiest way to approach this, considering data type representations and all of the Crystal complexity under the covers, is to layout your report with all 25 fields sized appropriately.
Then, at runtime, you will need to reposition the report objects, which could be a little tricky due to the relatively unstructured way in which crystal provides the information.
The way I would approach this is to loop through the report objects and generate one SortedList for the data fields and one SortedList for the header fields. They should be sorted on their Left position so that you can process them in appearance order.
Once you have the sorted lists of objects, you can cycle through each one and, if it was not selected by the user, set the Width to 0.
As you are moving through the fields, you will keep track of the current left position. The first field that you process will set your starting point, even if it is not visible. Then, for all subsequent fields, if the field is visible, you will set its left value to the current left position, then add its width plus some separator space to the current left position for the next field.
Hopefully this will help you solve your problem.
It sounds like this would be a good place for a cross-tab report. In this case you'd need to add a cross tab to your report header or footer and pass your data into the report with a column for each attribute descriptions and then group on the attribute description. See below for details:
Data:
RowID ColDesc ColValue
1 Attr1 Value1
1 Attr2 Value2
2 Attr1 Value3
Then you can add your crosstab where your row field is RowID, your column field is ColDesc and the field to summarize is ColValue. You can use a Max of summary on the summarized field since it is different.
This is untested, but I believe that the output for this should be:
CrossTab:
Attr1 Attr2
1 Value1 Value2
2 Value3
As you can see that as you add a new attribute it will show up as a new column in the crosstab. As I said previously, this is untested so I apologize for any errors, but I hope it is enough to help you out. Thanks
Give a look at these links
http://www.c-sharpcorner.com/UploadFile/uditsingh/CR1111022006055359AM/CR11.aspx
http://www.crystalkeen.com/articles/crystalreports/dynamiccrosstab.htm
Using this Google Search
Crystal Reports will not automatically add columns & headers to a report given a list of fields.
My recommendation is to use the Report Application Server .NET SDK to dynamically alter a report. The link includes the API reference, as well as samples.

Categories