question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Andrew O commented

get the string value of the status of a location to use in Decide activity

I would like to get the string value (OffSchedule - Unavailable) of the status of a location to use in a Decide Activity.

Thanks.

FlexSim 21.2.4
locationstatus
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Andrew O avatar image Andrew O commented ·

Hi @Tee Hiett, was Arun Kr's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Arun Kr avatar image
0 Likes"
Arun Kr answered

Hi,

If you are particular about using the status string of a resource, you can use the following code in the decide activity.

Object ResourceObj = Model.find("ResourceObjName"); // Getting Reference Of Object
string Status = ReosurceObj.stats.state().valueString; // Getting the status String
if(Status == "scheduled down" || Status == "down")
{
  return 1;
}
return 2;

For getting the exact string names of the states, you can refer to the state profile of the object to which you are trying to write the logic.

1664790555121.png

Alternately, you can use the state numbers which is easier to implement.

Object ResourceObj = Model.find("ResourceObjName"); // Getting Reference Of Object
int Status = ReosurceObj.stats.state().value // Getting the status num
if(Status == STATE_SCHEDULED_DOWN || Status == STATE_DOWN) // using the macros
{
  return 1;
}
return 2;

Regards,

Arun KR


1664790555121.png (70.6 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.