Monday, December 13, 2010

CSL (Comma Separated List)

A little SQL trick:

-- Recordset a CSL
select REPLACE(REPLACE(REPLACE((SELECT rtrim(CityID) as AFROM BaseCityORDER BY CityIDFOR xml PATH ('')),'</A><A>',','),'</A>',''),'<A>','')

 -- CSL a Recordset

declare @list varchar(1000)
set @list = 'Juan,Pedro,Alberto'
declare @x xml
@x = '<A>' + REPLACE(@list,',','</A><A>') + '</A>'

select x.item.value('.','varchar(20)') as nombre
from @x.nodes('//A') as x(item)

Table and Field Names

Don’t hardcode you table or field names.
Use something like; AttributeGroupMapRecord.TableUtils.TableDefinition.TableAliasName + "." + AttributeGroupMapTable. agm_AttributeGroup_ID.InternalName or just AttributeGroupMapTable. agm_AttributeGroup_ID.InternalName.

In the SP the table alias is most likely AttributeGroupMap_
filter.AddFilter(new BaseClasses.Data.SqlFilter(AttributeGroupMapRecord.TableUtils.TableDefinition.TableAliasName + "." + AttributeGroupMapTable. agm_AttributeGroup_ID.InternalName + " = " + AttributeGroupID.ToString()));

Thursday, December 9, 2010

Labels from Resource File

In the database TAB enter this:

<%# GetResourceValue("Label:FieldName") %>

In the Resource file add the corresponding entry:

<data name="Label:FieldName">