Hi....I've got the following PSCustom Object that is returned from an API. This is returned in a variable called $BPOrder.response
id : 60
parentOrderId : 0
shippingStatusCode : ASS
placedOn : 2015-03-04T09:54:38.000-05:00
createdOn : 2015-03-04T09:55:26.000-05:00
createdById : 1627
priceListId : 2
delivery : @{shippingMethodId=0}
currency : @{accountingCurrencyCode=USD; orderCurrencyCode=USD; exchangeRate=1.000000}
totalValue : @{net=72.80; taxAmount=0.00; baseNet=72.80; baseTaxAmount=0.00; baseTotal=72.80; total=72.80}
assignment : @{current=}
parties : @{customer=; delivery=; billing=}
I can return a list of the order IDs by
PS>$BPOrders.response | select-object ID
id
--
11
12
13
14
etc.
The parties, above is a hash table of hash tables. and I would think I could return the contents of those using dot notation but i doesn't appear to work.
$BPOrders.response | select parties.delivery.addressFullname, parties.delivery.addressCity etc. etc.
What I need is the delivery address of the customer coupled with the ID of the of the order. Something like:
$BPOrders.response | select id, parties.deliery.addressFullname, parties.delivery.addressCity
Ideas of how to do this?
I can get at the address and them by looping through each using the following statement:
#$BPOrders.response | foreach-object ($_) { `
(Out-String -InputObject $_.id)+`
(Out-String -InputObject $_.parties.delivery.addressFullName)+`
(Out-String -InputObject $_.parties.delivery.addresscompanyname)+`
(Out-String -InputObject $_.parties.delivery.addressLine1)+`
(Out-String -InputObject $_.parties.delivery.addressLine2)+`
(Out-String -InputObject $_.parties.delivery.addressLine3)+`
(Out-String -InputObject $_.parties.delivery.addressLine4)+`
(Out-String -InputObject $_.parties.delivery.postalcode)
}
This gives me just the data..... I'd really like to have the name pairs as well because I want to ulimately put these in a csv
60 <--ID
nichole steffens <--addressFullName
PO 58 <--addressline1
Saxeville <--addressline2
Wisconsin
54976
Here's what I want:
ID: 60
addressFullName: nichole steffens
addressLine1: PO 58
etc. etc.