SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


pscustomobject help


pscustomobject help

Author
Message
schleep
schleep
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2849 Visits: 1406
Hi gang,

I have an array, $Data, having a bunch of elements, $Datum, each of which contains something like this:

@{Date =30-Nov-12; Billing
Week=1; Billing
Month=DECEMBER; Q=Q1; Weekday=Friday; Calendar
Month=November; Day=30; Year=2012; Time Due=8:00 AM)

So for each $Datum, how can access the value, that's on the other side of "Date = " for example?

P



bruce 1565
bruce 1565
Mr or Mrs. 500
Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)Mr or Mrs. 500 (559 reputation)

Group: General Forum Members
Points: 559 Visits: 1031
If I understand correctly you have an array of hashes something like this.
$x = @{Date ='30-Nov-12'; 
BillingWeek='1';
BillingMonth='DECEMBER';
Q='Q1';
Weekday='Friday';
CalendarMonth='November';
Day='30';
Year='2012';
TimeDue='8:00 AM'
}

$y = @{Date ='29-Oct-13';
BillingWeek='2';
BillingMonth='November';
Q='Q2';
Weekday='Thursday';
CalendarMonth='October';
Day='29';
Year='2013';
TimeDue='9:00 AM'
}
$data = @($x, $y)


If so here’s one way to pick out individual values.
$data[0].Date  # 30-Nov-12
$data[1].Date # 29-Oct-13
$data[0].Weekday # Friday


schleep
schleep
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2849 Visits: 1406
Yup, got it. Was not getting any values for Date because column name had a trailing space.

Thanks Bruce.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search