dynamic-columns

Converting rows to columns SQL Server, T-SQL

被刻印的时光 ゝ 提交于 2019-12-25 08:26:14
问题 I have a function that produces a few rows as string values. The values are as follows: [12*02] [12*03] [12*04] [12*05] [12*06] [12*07] [12*08] [12*09] [12*10] [12*11] [12*12] [12*13] [12*14] [12*15] The values are actually different rows. So [12*01] is row 1 and [12*02] is row # 2 and so on. I want to use these values as column headers. So [12*01] is column 1 and [12*02] is column 2 and so on. I would have used a pivot but this string will keep changing every time and thats the very reason I

Unpivot table with multiple columns and dynamic column names

丶灬走出姿态 提交于 2019-12-21 20:24:17
问题 I am trying to unpivot a table with multiple rows and columns. Each row needs to be extratced to 2 rows with specific columns and the column names need to be renamed and a new column needs to added based on the columns selected! I am including before and after sample data and a script to setup the data. CREATE TABLE #tmpProducts ( ProductId INT, ProductName nVARCHAR(100), B2B_GrossRevenue DECIMAL(10,2), B2B_DirectCost DECIMAL(10,2), B2B_NetRevenue DECIMAL(10,2), B2C_GrossRevenue DECIMAL(10,2)

sql server pivot : group by with dynamic columns

你离开我真会死。 提交于 2019-12-19 11:32:15
问题 I have done a pivot on a table, generating dynamic columns : DECLARE @cols AS NVARCHAR(MAX); DECLARE @query AS NVARCHAR(MAX); select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Replace(variable,char(CAST(0x0016 as int)),'')) val FROM TABLEDATA ORDER BY val asc FOR XML PATH(''), TYPE ).value('.', 'NVARCHAR(MAX)') , 1, 1, ''); SELECT @query = 'SELECT time, country, disease, ' + @cols + ' FROM TABLEDATA PIVOT ( MAX(value) FOR variable IN( ' + @cols + ' )' + ' ) AS p; '; execute(@query); It

Dynamic columns with List<List> in <p:dataTable><p:columns>

允我心安 提交于 2019-12-19 09:22:07
问题 I'm attempting to generate a dataTable with columns dinamycally, so I've a List<List> when a List inside of a List is the content of my column, but when I try to show it I can't display not much. So, this is the code of my Bean: @ManagedBean @javax.faces.bean.ViewScoped public class Controlador { private List<List> estadistico; @PostConstruct public void inicializar(){ this.estadistico = new ArrayList<List>(); this.estadistico.add( Arrays.asList( new Integer[]{0,1,24})); this.estadistico.add(

Primefaces static and dynamic columns in datatable

大憨熊 提交于 2019-12-17 04:34:11
问题 I am using Primefaces 5.0 to create a dynamic datatable. My DataObject has some required fields and a List of optional "tupel" (key-value pair). The optional list may vary in size. Therefore I need a dynamic mechanism to show a List of DataObject in Primefaces.DataTable. My approach looks like: public class DataObject { private String staticval1; private String staticval2; private List<Tupel> optionalValues; // .. getter, setter, hashCode, toString..... } public class Tupel{ private String id

MS Access convert and summarise two rows into columns with unique names

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 00:46:52
问题 I'm really struggling to 'Transform' or pivot this simple two column table, is there a way ? All the solutions I have found so far ( pivot / transform / crosstab etc) require the data to have some kind of third field index number in order to create the column names. In my case each Itemcode can have any number of Itemimage and those itemimage sometimes are valid for more than one Itemcode . Typically the number of itemimage will be less than 20 but there are tens of thousands of Itemcode .

CSS to dynamically create columns

此生再无相见时 提交于 2019-12-12 14:36:03
问题 I have three <div> elements: <div class="foo">A</div> <div class="foo">B</div> <div class="foo">C</div> Desired behavior I'd like to write some CSS to create the following effect as the screen size changes: Undesired behavior I know how to implement the following (undesired) behavior: div.foo { display: inline-block; vertical-align: top; width: 300px; } Is there a simple way (pref. without any Javascript library) to achieve my desired behavior that will work on major browsers (Chrome, Safari,

fixed-fluid-fixed layout

馋奶兔 提交于 2019-12-12 04:55:36
问题 I'm trying to create a three column layout in CSS only with fixed left and right columns and a fluid central column. I have searched online but nothing has worked when I implement it. I don't know whether this is particularly relevant but my central column is (or contains, I've tried both) an iframe. This seems to be contributing to the complication. 回答1: Have you tried using an 960 grid ? http://960.gs/ Otherwise there are many examples for using fixed and fluid grid layouts in the web: http

set colmodel of jqGrid when rows loaded from server but before add to grid

半城伤御伤魂 提交于 2019-12-12 04:46:41
问题 I want to change my grid's colmodel dynamiclly and I did lots of search but non of the question thread answered me. I need to pivot a select in sql so after I execute my query I find out names and count of my grid's columns. In other posts I find the way of changing the colmodel but I don`t know when and where I must do it. It is not possible to execute query two time becuase It may changed in result and decrease performance. 回答1: One can use beforeProcessing callback to make many

GridView: how to add columns based on data from a separate data source

余生长醉 提交于 2019-12-12 04:00:30
问题 Adding columns to a GridView programmatically is easy. There are examples here and here. Here is a similar question, but it's been answered the same way - to create a datatable and bind it to the GridView. But won't that remove the original link to the main data source? My GridView below already has a bind to the sqldatasource below it. Text="Location Board" Width="100%"></asp:Label> <asp:GridView ID="gvLocationBoard" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns=