Search the Community
Showing results for 'can one us an if statement in an expression'.
-
I have an instance in which I am using task sequences and I need to turn "auto cancel trigger" to none. There is a task that is dependent on whether or not the previous task actually occurred so I was going to add a conditional statement to the table. How can I go about writing an expression to check whether the previous task (also a predecessor) actually got executed or cancelled? Is there a nested expression I can take advantage of?
-
2 Entities with different process times through Server
CWatson replied to BKerr's topic in SI General Discussions
You can do this in several different ways. If you simply have 2 entity types, an easy way to do it would be with a Math.If statement within the Processing Time property. For example, Math.If(Is.Red, 2, 4) - given you had 2+ entity types, the ones that have the entity name 'Red' would process for 2 minutes (or time units specified), all others would process for 4 minutes (time units). You can have multiple Math.If statements (Is.Red,2, Is.Green,4, Is.Blue, 5, 6), for example. Of course, you can use more complex values than 2, 4, 5 for processing times. A more flexible way would be to store the information within a table. That is, have a data table that includes the names of all the entity types in an Object Reference type (Entity) property. Then, within that column, set the Auto-set Table Row Reference property to 'True'. This way, when an entity of a given type is created, it has a reference to the row associated with its name automatically. Then, have another column of type expression (so you can specify a distribution, etc.) which includes the server processing times for each entity type. Then, within the Server, reference TableName.ServerProcessingTimeName as the processing time. -
Complex Selection Condition doesn't work?
ptkolodziejczyk replied to Damarow's topic in SI General Discussions
The first expression you wrote is not a selection condition but a logic statement, that can evaluate to 1 or 0. For selection you need to use the Candidate construct as in the second expression. E.g. ((Candidate.Server.AttributeA == 1) && (Candidate.Server.AttributeB == 2)) Mind that there is a difference between using .Is and ==, the first of which checks if the candidate belongs to a particular class, and the latter checks for a value. Finally, AssociatedObject to a node might not be assigned. Make sure it is and that it is of the right class.