Profile picture for user RBeddoe

Greetings Community,

Here is my dilemma.

I am importing raw string data into attributes. Some of these attributes have a pre-set list of allowable values. In order to use:

attribute.setValue(<value>)

<value> has to be an integer. The problem is, I am not sure how I can compare my raw string data to the data in the pre-set list represented by an integer.

The image shows the properties of this one of the attributes. Note the pre-set list of allowable values.

If I am importing a raw string, how do I obtain the pre-set collection from the attribute using Aris Script?

 

Rick Beddoe

Cargill Aris Technical Analyst

Minneapolis, MN, USA

 

 

by Ciska de Jager
Posted on Thu, 08/30/2012 - 06:11

Hi Rick,

I've created my own function to obtain possible attribute values (for drop-down attribute selection values)

function getAttributeValues(iattrnum)

{

  var AttrArray = new Array();

  var attValTypes = ArisData.ActiveFilter().AttrValueTypeNums(iattrnum);

  for(var a=0;a<attValTypes.length;a++) {

    AttrArray.push(ArisData.ActiveFilter().AttrValueType(iattrnum, attValTypes[a]));

  }

  return AttrArray.sort();

}

It returns an array, if you want to do a quick test to determine if the value that you are importing is part of the pre-defined list you can use the command join to parse the array into a string and search the string for the imported value.

In order to use the setValue() command for above you don't need the integer - if your imported value is part of the pre-defined list you can use setValue with the imported value. for instance setValue("Removed") with update your attribute successfully.

Ciska

0
by Rick Beddoe Author
Posted on Thu, 08/30/2012 - 20:26

Thanks Ciska,

AttrValueTypeNums was the function I was looking for. I can use JSLINQ to easily query the collection for a match without using 'join'. It may sound strange, but I am not a fan of comparing portions of a string.

I tried using the string value as in setValue("Removed") and it does not work. I could only get it to work with an integer.

Rick Beddoe

Cargill Aris Technical Analyst

Minneapolis, MN, USA

0
by Rick Beddoe Author
Posted on Thu, 08/30/2012 - 22:34

Well, I tried using setValue with just text and now it seems to be working fine. Not sure what I did wrong before, but that will be much easier.

Still good to know how to get that info using AttrValueTypeNums. Thanks Ciska :)

Rick Beddoe

Cargill Aris Technical Analyst

Minneapolis, MN, USA

 

 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon