Angular - filter array to retrun the first object

Use the below code to filter the array to return only the first object

array.find(data => data.item_id == 1)

SSRS - make first letter of every word in string to uppercase

Call the below function:


=StrConv(Fields!FieldName.Value, vbProperCase)

MVC razor - radio button click by label

Wrap each radio button and associated label text inside a <label> element:
<label> @Html.RadioButtonFor("gender", "Male") Male </label>
<label> @Html.RadioButtonFor("gender", "Female") Female </label>

JQuery - get radio button value

<!DOCTYPE html>



<script src=""></script>





         var radioValue = $("input[name='gender']:checked").val();


                alert("Your are a - " + radioValue);












<h1>Welcome to My Homepage</h1>

  <input type="radio" name="gender" id="gender" value=".bbb"> Male<br>

  <input type="radio" name="gender" id="gender" value=".bbb,.intro"> Female<br>

  <input type="radio" name="gender" id="gender" value="other"> Other

<p class="intro xxx bbb">My name is Donald.</p>

<p>I live in Duckburg.</p>


<div class="intro">My name is Dolly.</div>

<p>I live in Duckburg.</p>




Pass datetime parameters to openrowset/query

DECLARE @sqlCommand varchar(1000)
DECLARE @StartDate datetime
DECLARE @EndDate datetime
DECLARE @local int
SET @StartDate = '20100101'
SET @EndDate = '20110101'
SET @local = 1
SET @sqlCommand = 'SELECT * FROM OPENROWSET(''SQLNCLI'',''server=servername;trusted_connection=yes'',''SET FMTONLY OFF exec procname ''''' + convert(varchar(10),@StartDate,112) + ''''',''' + convert(varchar(10),@EndDate,112) + ''''',' + cast(@local as varchar(10)) + ''')'

PRINT @sqlCommand
--EXEC (@sqlCommand)

Iterate through rows of dataset in report's custom code

The ideal is to "transform" the data set into a multivalued parameter (or if you need several fields, transform it in multiple multivalued parameters).

The multivalued Report Parameter must have the following characteristics:

Hidden = True

Allow Multiple Values = True

Available Values tab:

Chose the desired dataset. Select the searchable id as Value id, and the field you want to expose as Label Field.

Default Values Tab - Get Values from a Query.

Choose the same Dataset as choosen in the available Values Tab.

Value Field the same you choose for value id.

Set the parameter to never refresh (or it will be loading the data from each iteraction of another parameter).

Now, the idea is make this Parameter "searchable". From this point you exposed the Dataset as an array in the Multi valued Parameter.

Now in a custom code insert the following code:

function GetDataSetLabelFromValue( id as integer) as String

dim i as integer

i = 0

for i = 1 to Report.Parameters!YourParameter.Count()

if Report.Parameters!YourParameter.Value(i) = id then

GetDataSetLabelFromValue = Report.YourParameter!ReportParameter1.Label(i)

Exit For

End if

next i

End Function



SQL - Query xml attribute


SELECT TOP 100 s.owner_id, mpln_key, mpln_member, mpln_owner, pln_key , pln_cb_id ,

asset_mix.value('(/asset_mix/mem_plan/@market_value)[1]','decimal(18,2)') as market_value,

asset_mix.value('(/asset_mix/mem_plan/@plan_allocate_rating)[1]','varchar(2)') as plan_allocate_rating,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Short Term (GTD Investments)"]/@investment_type_EN)[1]','varchar(30)') as investment_type_EN,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Short Term (GTD Investments)"]/@asset_allocation)[1]','varchar(30)') as asset_allocation,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Global Equity"]/@investment_type_EN)[1]','varchar(30)') as investment_type_EN,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Global Equity"]/@asset_allocation)[1]','varchar(30)') as asset_allocation,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Canadian Equity"]/@investment_type_EN)[1]','varchar(30)') as investment_type_EN,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Canadian Equity"]/@asset_allocation)[1]','varchar(30)') as asset_allocation,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Bonds"]/@investment_type_EN)[1]','varchar(30)') as investment_type_EN,

asset_mix.value('(/asset_mix/mem_plan/asset_mix_result[@investment_type_EN="Bonds"]/@asset_allocation)[1]','varchar(30)') as asset_allocation


from [DC4Reports].[dbo].[member_plan_wrapper_extraction] as s

where owner_id= 3620

SQL -Update XML column


declare @new_rating int

set @new_rating = 0



UPDATE [member_plan_wrapper_extraction]

SET asset_mix.modify('replace value of (/asset_mix/mem_plan/@plan_allocate_rating)[1] with sql:variable("@new_rating") ')

WHERE owner_id=@owner_id

and mpln_member = @mpln_member

and mpln_owner = @mpln_owner

and pln_cb_id=@pln_cb_id ;

SQL - Query to Find Column From All Tables of Database

 SELECT AS table_name,
 SCHEMA_NAME(schema_id) AS schema_name, AS column_name
 FROM sys.tables AS t
 INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
 WHERE LIKE '%sp_id%'
 ORDER BY schema_name, table_name;

SQL Format datetime

select convert(varchar, getdate(), 100) convertResult,100 style union
select convert(varchar, getdate(), 101),101 union
select convert(varchar, getdate(), 102),102 union
select convert(varchar, getdate(), 103),103 union
select convert(varchar, getdate(), 104),104 union
select convert(varchar, getdate(), 105),105 union
select convert(varchar, getdate(), 106),106 union
select convert(varchar, getdate(), 107),107 union
select convert(varchar, getdate(), 108),108 union
select convert(varchar, getdate(), 109),109 union
select convert(varchar, getdate(), 110),110 union
select convert(varchar, getdate(), 111),111 union
select convert(varchar, getdate(), 112),112 union
select convert(varchar, getdate(), 113),113 union
select convert(varchar, getdate(), 114),114  union
select convert(varchar, getdate(), 120),120  union
select convert(varchar, getdate(), 121),121  union
select convert(varchar, getdate(), 126),126  union
select convert(varchar, getdate(), 127),127  union
select convert(varchar, getdate(), 130),130  union
select convert(varchar, getdate(), 131),131


09:05:22 108
09:05:22:173 114
12-17-2013 110
12/17/2013 101
14 jQuery15205048664805831008_1387289176437? 1435  9:05:22:173AM 130
14/02/1435  9:05:22:173AM 131
17 Dec 2013 106
17 Dec 2013 09:05:22:173 113
17-12-2013 105
17.12.2013 104
17/12/2013 103
2013-12-17 09:05:22 120
2013-12-17 09:05:22.173 121
2013-12-17T09:05:22.173 126
2013-12-17T09:05:22.173 127
2013.12.17 102
2013/12/17 111
20131217 112
Dec 17 2013  9:05:22:173AM 109
Dec 17 2013  9:05AM 100
Dec 17, 2013 107