cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Translate the entire conversation x

Computed Logic for ASIL and CAL fileds

Rubiya
5-Regular Member

Computed Logic for ASIL and CAL fileds

I want Computed Logic for Test case Tracker to populated ASIL & CAL filed values with " Verifies" Filed which linked to 12 requirements trackers 

If I select Verifies item, my Test case tracker ASIL / CAL values should automatically generate based on its requirement ASIL / CAL values

 

Safety Requirement Trackers have ASIL Field (4 Trackers)

Security Requirement Trackers have CAL Filed (4 Trackers)

 

Now in my Test case if I select Verifies item of any requirement my ASIL values should automatically populated

4 REPLIES 4

A few Computed Expressions & potentially some Shared Fields should make this possible!

 

So first to determine if we need shared fields: if the Label of the ASIL Fields in all of the Safety Requirement Trackers are the same, and the same for the CAL Fields in the Security Requirement Trackers, then we can simply use that common Label to reference the field in the Test Case tracker. Otherwise - if the labels for the field representing the same value in say two Safety Requirement Trackers are different for example, then we will need to create a Shared Field to allow the Test Case tracker to easily obtain the value no matter the label.
 
Of course if the different fields across trackers are different types, that may require additional logic to account for this in your expressions.

In this case, I simply created 4 trackers - two Safety Requirement with ASIL Fields and 2 Security Requirement with CAL Fields - but with different labels, so requiring a Shared Field:
JosephM_SAI_0-1741613958480.png

ASIL Fields in the two Safety Requirements

JosephM_SAI_1-1741614029972.png

CAL Field in Physical Security Requirement

JosephM_SAI_2-1741614090624.png

CAL Field in Digital Security Requirement

Customizing the Test Case tracker is next! For the ones not requiring a shared field, they'd look like so:

 

Verifies[0]['ASIL Field']

 

where ASIL Field is the label of the upstream tracker item fields.

 

Where a Shared Field is needed, it's a slight change to use the sharedField function instead:

 

sharedField("CALField", Verifies[0])

 

where CALField is the Shared Field Name.


Of course if you need to support multiple upstream requirements, you'd use some list-functions such as a Projection and any additionally needed logic, such as summing up all the values for example:

 

sum(Verifies.{upstream | sharedField("CommonField", upstream)})

 


An example of the above fields (and an additional common field) setup looks like so: 

JosephM_SAI_3-1741614546726.png Test Case with no Verifies:

both ASIL & CAL fields are hidden with the Common Field without a value

JosephM_SAI_4-1741614620618.png Test case with a Safety Requirement upstream:

ASIL Field visible & populated

JosephM_SAI_5-1741614716772.png

Test Case with a Security Requirement upstream:

CAL Field visible & populated

 


If you additionally desire to hide the unused fields, you can of course use another computed expression for the Hide If value:

 

empty Verifies || contains(Verifies[0].tracker.name, "Security")

 

and make this as complex or as simple as needed.

 

Hopefully this is enough to get you started, feel free to reply if there is anything I missed, and good luck!

Rubiya
5-Regular Member
(To:JosephM_SAI)

Hi @JosephM_SAI ,

 

I have gives the Computed Logics as above , iam able get the Result but including the Option id and other property detials like below : ASIL - QM(C) i dont want the other details

Rubiya_0-1741756512757.jpeg

Current logic iam using Subjects >> Verifies 

Rubiya_1-1741756577834.png

 

Choice list [4[ >> CAL 

Rubiya_2-1741756612274.png

 

 

Yup that's returning the full option - you can get the `.name` of those, so this should work for you:

 

subjects[0].ASIL[0].name

 

and it gracefully evaluates to nothing if the ASIL field for the subject has no chosen value.


If this is a multiple choice list and you want all of their names, that'd involve a projection at minimum:

 

join(subjects[0].ASIL.{chosen | chosen.name}.toArray(), '
')

 

 to generate

 

A
B

 

 given an upstream requirements with both A and B options chosen.

Hello @Rubiya,

 

It looks like you have a response from a community member. If it helped you solve your question please mark the  reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Announcements



Top Tags