BookmarkSubscribeRSS Feed
prholland
Fluorite | Level 6
I'm developing an EG 4.1 Add-In using VB.Net. I'm currently using SASVariableSelector.GetAssignedVariable(ROLE,n) to extract the name of a variable in a Role list. Is there a method or property I can use to extract the label of that variable, instead of the name?

.........Phil
3 REPLIES 3
ChrisHemedinger
Community Manager
Phil,

You can use the ISASTaskData and ISASTaskDataColumn interfaces to get this information.

Here is a C# snippet that should translate to VB.NET fairly easily.

[pre]
using SAS.Shared.AddIns;

ISASTaskData data = Consumer.ActiveData;
ISASTaskDataAccessor da = data.Accessor;
// to do that, we need to "open" the data to get a peek at the column
// information
if (da.Open())
{
for (int i=0; i < da.ColumnCount; i++)
{
ISASTaskDataColumn ci = da.ColumnInfoByIndex(i);
cmbReport.Items.Add(ci.Label);
}
da.Close();
}
[/pre]

Chris
SAS Innovate 2025: Call for Content! Submit your proposals before Sept 25. Accepted presenters get amazing perks to attend the conference!
prholland
Fluorite | Level 6
Chris,

I found something similar to your code in the Compare Add-In code in the VB.Net Samples. Unfortunately, although it works very well when picking up the labels from the underlying data set, if I've changed the label or format in the SAS Variable Selector object, it ignores those changes.

Is there any interface to the SAS Variable Selector object that can give me the changed label or format? If there isn't anything suitable, I might try to include user-editable labels and formats in the SAS Variable Properties object instead.

.........Phil
ChrisHemedinger
Community Manager
Phil,

Have you tried the GetVariablesFormat(string varname) call on the SASVariableSelector control?

You can also subscribe to an event: VariableFormatChanged. With the event you can be notified when the user changes the value. Using GetVariablesFormat(), you can query for the new or current value.

Chris
SAS Innovate 2025: Call for Content! Submit your proposals before Sept 25. Accepted presenters get amazing perks to attend the conference!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 659 views
  • 0 likes
  • 2 in conversation