Advertisement
Ruslan_Rayanov

Chart Bar

Oct 18th, 2020
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.28 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[crud_tst-chart2_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 float, color nvarchar(64) )
  14.  
  15.     insert into @result
  16.     select 'Smartwatch' Title, 104 Value, 'pink' Color
  17.     union
  18.     select 'Videocard' Title, 102 Value, 'powderBlue' Color
  19.     union
  20.     select 'Kyboard' Title, 91 Value, 'lightGreen' Color
  21.     union
  22.     select 'Transmitter' Title, 70 Value, 'aqua' Color
  23.     union
  24.     select 'Voice recorder' Title, 24 Value, 'lightGrey' Color
  25.        
  26.     -- 1 SELECT - сами данные    
  27.     select * from @result
  28.     order by Value
  29.  
  30.     -- 2 SELECT - кол-во в таблице
  31.     select count(*) from @result   
  32.  
  33.     -- 3 SELECT Дополнительные настройки таблицы
  34.     select 'chart' ViewType, 'bar' ChartType, iif(@langID=1, 'By quantity sold', 'По количеству проданного') ChartTitle, 0 ChartWidth, 0 ChartHeight, 1 HidetitleCount,
  35.         iif(@langID=1, 'Top 5 Popular Products', 'Топ 5 популярных продуктов') Title
  36. END
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement