Advertisement
Ruslan_Rayanov

Chart Line

Oct 18th, 2020
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.25 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[crud_tst-chart3_getItems]
  2.     @filters CRUDFilterParameter READONLY,  
  3.     @sort sql_variant,
  4.     @direction nvarchar(8),
  5.     @page int,
  6.     @pageSize int,
  7.     @username nvarchar(32)
  8. AS
  9. BEGIN
  10.     declare @langID int
  11.     select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
  12.  
  13.     declare @result TABLE (title nvarchar(256), value nvarchar(256), color nvarchar(64) )
  14.  
  15.     insert into @result
  16.     select iif(@langID=1, 'Customers', 'Заказчиков') Title, '1,3,7,8,12' Value, 'green' Color
  17.     union
  18.     select iif(@langID=1, 'Orders', 'Заказов') Title, '3,7,5,12,9' Value, 'blue' Color
  19.     union
  20.     select iif(@langID=1, 'Income, dollars', 'Доход, тыс.руб.') Title, '5,15,12,18,16' Value, 'red' Color    
  21.    
  22.     -- 1 SELECT - сами данные    
  23.     select * from @result
  24.  
  25.     -- 2 SELECT - кол-во в таблице
  26.     select count(*) from @result   
  27.  
  28.     -- 3 SELECT Дополнительные настройки таблицы
  29.     select 'chart' ViewType, 'line' ChartType, iif(@langID=1, 'March 2020', 'Март 2020') ChartTitle, 0 ChartWidth, 0 ChartHeight, '5,10,15,20,25' ChartLineCommaLabels, 1 hideTitleCount,
  30.         iif(@langID=1, 'Company stat', 'Статистика работы компании') Title
  31. END
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement