Data Refresh in Tabular Editor
Updated: Jun 21, 2022
***The scripts shown in this post have been updated to work in both Tabular Editor 2.x & Tabular Editor 3.
Tabular Editor offers so many inherent features which make it such an invaluable tool for developing tabular models. However, what makes it even better is the ability to write custom C# code using the Advanced Scripting window. This creates a plethora of possibilities only limited by the imagination. Many of my recent posts take advantage of this feature and this post is no exception.
As with all nifty advanced scripts, I recommend saving these scripts as Custom Actions so you can have easy access to them at any time.
Processing multiple tables
It has previously been shown how to refresh a table within Tabular Editor but we can take it a step further. The script below is able to process multiple tables - not just a single table. Naturally, it can also process a single table. Here's how it works:
Note: This requires Tabular Editor version 2.12.1 or higher and that you are connected live to an Analysis Services instance (File->Open->From DB...). This can also be a Power BI Premium dataset or if Tabular Editor is opened using the Power BI Desktop 'External Tools' option.
Within Tabular Editor, select the tables you want to process within the Table List.

2. Copy and paste the code below into the Advanced Scripting window (save it as a Custom Action).
#r "Microsoft.AnalysisServices.Core.dll"
using ToM = Microsoft.AnalysisServices.Tabular;
var refreshType = ToM.RefreshType.DataOnly;
ToM.SaveOptions so = new ToM.SaveOptions();
//so.MaxParallelism = 10;
foreach (var t in Selected.Tables)
{
string tableName = t.Name;
Model.Database.TOMDatabase.Model.Tables[tableName].RequestRefresh(refreshType);
}
Model.Database.TOMDatabase.Model.SaveChanges(so);
3. Update the refreshType parameter according to how you would like to process the tables. The options are documented here.
4. If you want to use the Sequence command to specify the Max Parallelism option, simply uncomment the 'so.MaxParallelism' line and specify the desired MaxParallelism value.
5. Click the play button (or press F5) to start the data refresh.
Processing multiple partitions
The only difference in processing partitions is that you select partitions. Otherwise, the instructions are the same as for processing tables. Just use the code below.
#r "Microsoft.AnalysisServices.Core.dll"
using ToM = Microsoft.AnalysisServices.Tabular;
var refreshType = ToM.RefreshType.DataOnly;
ToM.SaveOptions so = new ToM.SaveOptions();
//so.MaxParallelism = 10;
foreach (var p in Selected.Partitions)
{
string tableName = p.Table.Name;
string partitionName = p.Name;
Model.Database.TOMDatabase.Model.Tables[tableName].Partitions[partitionName].RequestRefresh(refreshType);
}
Model.Database.TOMDatabase.Model.SaveChanges(so);Processing the model
Processing the whole model is not recommended. However, recalculating the model is fine. Just these 4 lines of code are needed to do the job. Simply paste this code into the Advanced Scripting window and click play.
#r "Microsoft.AnalysisServices.Core.dll"
using ToM = Microsoft.AnalysisServices.Tabular;
var refreshType = ToM.RefreshType.Calculate;
Model.Database.TOMDatabase.Model.RequestRefresh(refreshType);
Model.Database.TOMDatabase.Model.SaveChanges();additional context
These scripts directly access the Tabular Object Model and actually do not generate TMSL (to which many of us are accustomed). The scripts (well, the RequestRefresh method) generate XML. TMSL is much cleaner and easier to read which is why it is used when scripting out code in this context. However, the TMSL gets translated into XML by the engine. Therefore, the scripts used in this post skip the TMSL part and feed XML directly to the server (since the engine does not care about code beautification). You can run a SQL Server profiler trace and see this for yourself. Actually, when you run TMSL you will also see the XML command (translated from TMSL) in the profiler trace. When you run a profiler trace against the scripts in this post you will only see the XML command.
Conclusion
It should be noted that processing large datasets within Tabular Editor is not recommended. This method is best for quickly processing relatively smaller datasets. Not to worry, I have a new tool coming out soon which offers a more robust solution for more complex processing scenarios. Stay tuned!

https://qq88.fun/ giúp tôi đánh giá sự nhất quán của các nút thao tác giữa những khu vực khác nhau. Khi chuyển từ thể thao sang casino trực tiếp hoặc xổ số, tôi chú ý xem màu sắc, kích thước và cách đặt nút có duy trì quy luật quen thuộc hay không. Nếu cùng một chức năng nhưng thay đổi cách trình bày liên tục, người dùng có thể phải mất thêm thời gian để xác định vị trí cần nhấn. Tôi cũng xem xét độ tương phản giữa nút chính và phần nội dung xung quanh, đặc biệt trên màn hình điện thoại. Theo tôi, giao diện không cần quá nhiều hiệu ứng; điều quan trọng hơn là các thao…
https://hi88com.biz/ gợi cho mình sự tò mò về cách hệ thống duy trì mạch sử dụng khi xuất hiện nhu cầu hỗ trợ. Mình thường bắt đầu với nội dung đang quan tâm rồi mới chuyển sang chức năng khác nếu cần thêm thông tin. Có lúc mình sử dụng Thể thao, chuyển sang Casino rồi tìm đến khu vực chăm sóc khách hàng để xem hướng dẫn liên hệ. Phần hỗ trợ có vai trò riêng nên mình dễ phân biệt với những danh mục đã trải nghiệm. Sau khi tìm hiểu thông tin cần thiết, mình quay lại khu vực trước đó bằng những mốc đã ghi nhớ. Qua nhiều lần thao tác, mình nhận thấy việc phân chia…
https://cm88.buzz/ làm mình quan tâm đến cách các khu chính duy trì vị trí dễ nhận biết qua nhiều lần sử dụng. Mình thường ghi nhớ một vài điểm trên giao diện rồi dùng chúng để xác định hướng khi quay lại. Khi đi qua Đá gà và Bắn cá, sau đó chuyển sang Thể thao, từng danh mục vẫn được tách riêng nên mình dễ nhận ra mình đã thay đổi khu. Việc chuyển đổi vì thế không phụ thuộc quá nhiều vào việc nhớ chính xác những thao tác trước đó. Qua một thời gian, mình quen với cấu trúc và tìm nội dung dựa trên bố cục nhanh hơn. Với mình, sự nhất quán này giúp giao diện…
Slope stability requires careful attention to ground conditions and potential hazards. A landslide risk assessment provides useful guidance for understanding these factors. The College of Contract Management offers practical courses for professional development.
tt88 casino khiến tôi chú ý đến cách hệ thống hiển thị các thông báo liên quan đến trạng thái trò chơi. Tôi thường mở một nội dung, quan sát thông báo trong lúc tải rồi quay lại danh mục để kiểm tra xem trạng thái trước đó có được ghi nhận không. Nếu thông báo quá ngắn hoặc biến mất trước khi tôi kịp đọc, tôi sẽ khó xác định chuyện gì vừa xảy ra. Tôi cũng để ý vị trí xuất hiện của thông báo để xem chúng có che mất những nút thao tác quan trọng hay không. Cách phản hồi này ảnh hưởng khá nhiều đến cảm giác kiểm soát khi sử dụng. Với tôi, thông báo…