Jump to content
Software FX Community
Sign in to follow this  
Sjenkins

Inner Gadget Value

Recommended Posts

Testing DEMO. [:S]

 Instead of having 4 digital gadgets I wanted to create one gadget with four InnerDigitalPanels..

I can do so but how do I set the value of each? I want each inner gadget to be a different SQL select statement..

Share this post


Link to post
Share on other sites

Unfortunately the only way to "bind" individual properties (in this case InnerDigital values but it really applies to other properties as well) requires Powershell although there is a trick that will allow you to use the PowerGadgets Creator UI later to customize the visual attributes.

1) Write a powershell script that collects the data you need from different SQL statements into an object. This will be your data layer :-)

$count = (invoke-sql -Server YourServerName -Database YourDatabaseName -SQL "SELECT Count(*) as MyCount FROM Movies").MyCount
$quantity = (invoke-sql -Server YourServerName -Database YourDatabaseName -SQL "SELECT SUM(Quantity) as Quantity FROM Movies").Quantity

$obj = new-object System.Object
add-member -inputobject $obj -membertype NoteProperty -Name Count -value $count
add-member -inputobject $obj -membertype NoteProperty -Name Quantity -value $quantity
$obj

2) Create a PowerGadgets template (not a PGF) with as many inner gauges as needed. Note that to move an inner gauge you will need to set its Layout.Target to AnchorPoint so that you can move it around using Layout.AnchorPoint

out-gauge -config

3) Pipe the data returned by your script to a gauge that uses the previously saved template

C:\Scripts\dbdata.ps1 | out-gauge -value Count -template InnerDigital -InnerGauges_0_DigitalPanel_Value {$_.Quantity}

If you already use Powershell at this point you can customize your template and possibly save the previous command in a separate script. If you want to use PGF files so that you can simply double click and run, you can use the following trick

- Run the gauge command and press "Ctrl-C" when the gadget window has the focus
- Run the Powergadgets Creator and press "Ctrl-V" a new gadget will be added that uses powershell as the data provider and has the additional links between the inner digital and the extra properties
- Remove the empty item present in your gadget (Edit - Previous) and then (Edit - Delete)

You can see an explanation of this feature on this blog post

Regards,

JuanC

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...