Dynamic Text for label

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
StupidSexyFlanders
Posts: 107
Joined: Sun Nov 27, 2011 9:22 am

Dynamic Text for label

Post by StupidSexyFlanders » Tue Jun 19, 2012 6:25 am

I need a label that will reflect the current working domain when the form loads (using PSS3.0.4). Here's what I have so far (just showing relevant sections):$OnLoadFormEvent={#TODO: Initialize Form Controls here $getDomain = Get-ChildItem env:USERDOMAIN [string]$D = $getDomain.Value} $DomainName.Font = "Microsoft Sans Serif, 9pt, style=Bold" $DomainName.ForeColor = 'Black' $DomainName.Location = '125, 9' $DomainName.Name = "DomainName" $DomainName.Size = '225, 16' $DomainName.Text = $DIf I replace $Domain.Text = $D with $Domain.Text = "My Domain Name", the label shows that string as its label. But the $D value is not showing at all. When I run this is a PS CLI the value of $D is returned as the proper string.I also tried defining the variables outside the OnFormLoadEvent region and got the same result.
Mike

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Dynamic Text for label

Post by davidc » Tue Jun 19, 2012 6:28 am

It could be that the getDemain variable is null. Try this instead: $env:UserDomain David
David
SAPIEN Technologies, Inc.

User avatar
StupidSexyFlanders
Posts: 107
Joined: Sun Nov 27, 2011 9:22 am

Dynamic Text for label

Post by StupidSexyFlanders » Tue Jun 19, 2012 7:12 am

Ah, that was the key. I replaced all this:$getDomain = Get-ChildItem env:USERDOMAIN[string]$D = $getDomain.Value$DomainName.Text = $DWith just this: $DomainName.Text = $env:UserDomainThanks!
Mike