Same code – different output. ISE vs PS Console and VSCode.

Hey Guys,

Help needed here… I was just finishing another function for UK Power Cuts (still dirty as pile of dung I know, but works :P) while I noticed something weird.

Scottish and Southern have power cuts info in Javascript generated tables, the thing is, each position might be slightly different / have different fields – for instance one position will not have information about estimated time Engineer will be on place.

Let me show you what I mean on the, picture as we all know it is worth a thousand words:ScottishAndSouthern.jpg

Unfortunately as I mentioned on the picture – I do not know all these fields. Seems like that “Engineer Expected at” is the only one, but am I sure? No, I am not.

So I do not really know what “properties” of the power cut I may expect. The only solution I found here is to build objects where properties’ names are read in dynamic way. And all was working as expected, until I wanted to print out the list of all power cuts on the screen.

When first processed object will have 3 attributes, and the second one 4, only 3 common attributes will be shown whilst making “format-table” or “select-object *”, so I needed to specify properties.

Seems easy, right? This is how it is done.

I am reading properties of all objects (which are power cuts instances in this case) and add them to the variable $Allproperties. Later, all I do is taking all unique values and put them to the array of strings:

$uni = $Allproperties | select -Unique

Having that array of strings I am preparing the simple output:

$FinalObject | ft $uni

And then I was testing it and got the following…

Visual Studio Console:

VSCode_Output.jpgWoah looks good! All 5 columns are there despite first processed object is missing one of them.

PowerShell Console:

PSConsole_Output

Same here, all fine.

And ISE:

ISE_Output

Where is my 5th column?!?!

So ISE is not displaying a column even when it is provided, it might be because earlier object didn’t have that property, but shouldn’t it be displayed like in other consoles (PS and VSCode)?

Need to figure this out…

Something_Is_Not_right.gif

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s