private async static Task GenerateData() { var dataClient = new DatasetsClient(pbi); var created = (await dataClient.List()).value.First(ds => ds.name == "resourceManager"); var tables = await dataClient.ListTables(created.id); var dataRows = new TableRows <resourceMeasures>(); for (int i = 0; i < 1000; i++) { dataRows.rows.Add(new resourceMeasures() { Id = Guid.NewGuid().ToString("n"), InServiceDate = DateTime.Now.AddYears(-4), IsRunning = true, LastMeasure = DateTime.Now, Name = "Engine" + i.ToString(), RPM = 6000, Temperature = 431.6 }); } await dataClient.ClearRows(created.id, tables.value.First().name); await dataClient.AddRows(created.id, tables.value.First().name, dataRows); while (true) { Console.Write("."); foreach (var row in dataRows.rows) { row.RPM = (int)(6000 * Math.Sin(Math.PI * (DateTime.Now.Second / 59D))); row.Temperature += new Random((int)DateTime.Now.Ticks).Next(-5, 5); row.LastMeasure = DateTime.Now; row.IsRunning = row.RPM > 1; Thread.Sleep(1); } await dataClient.AddRows(created.id, tables.value.First().name, dataRows); } await dataClient.ClearRows(created.id, tables.value.First().name); }
//Groups: The Delete Rows operation deletes Rows from a Table in a Dataset in a Group. //DELETE https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/tables/{table_name}/rows //Delete Rows operation: https://msdn.microsoft.com/en-US/library/mt238041.aspx static void DeleteRows(string groupId, string datasetId, string tableName) { var datasetClient = new DatasetsClient(pbi); datasetClient.ClearRows(groupId, datasetId, tableName); }
private async static Task GenerateData() { var dataClient = new DatasetsClient(pbi); var created = (await dataClient.List()).value.First(ds => ds.name == "resourceManager"); var tables = await dataClient.ListTables(created.id); var dataRows = new TableRows<resourceMeasures>(); for (int i = 0; i < 1000; i++) { dataRows.rows.Add(new resourceMeasures() { Id = Guid.NewGuid().ToString("n"), InServiceDate = DateTime.Now.AddYears(-4), IsRunning = true, LastMeasure = DateTime.Now, Name = "Engine" + i.ToString(), RPM = 6000, Temperature = 431.6 }); } await dataClient.ClearRows(created.id, tables.value.First().name); await dataClient.AddRows(created.id, tables.value.First().name, dataRows); while (true) { Console.Write("."); foreach (var row in dataRows.rows) { row.RPM = (int)(6000 * Math.Sin(Math.PI * (DateTime.Now.Second / 59D))); row.Temperature += new Random((int)DateTime.Now.Ticks).Next(-5, 5); row.LastMeasure = DateTime.Now; row.IsRunning = row.RPM > 1; Thread.Sleep(1); } await dataClient.AddRows(created.id, tables.value.First().name, dataRows); } await dataClient.ClearRows(created.id, tables.value.First().name); }