Forums

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

How can I check the presence of specific components in the project using the sil script?

Helen Porter
Contributor
July 10, 2020

Hi,

We need to develop functionality for creating components in projects using the sil script.
To do this, we will use the routine: admAddProjectComponent ()

But to do this, you need to check for the presence of certain components in the project. How can I make a check also via the sil script?

3 answers

1 accepted

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2020

Correct! I believe that admGetProjectComponent should not work like this. Anyway do not check if component exists or not. Just use 

admAddProjectComponent("VTBTOP", "TEST", "Verify the addition of components.", "",0);

If such a component exists it will not create a new one.

Helen Porter
Contributor
July 15, 2020

Yes, everything worked out.
Thank you very much!

0 votes
Helen Porter
Contributor
July 15, 2020

Messages disappeared somewhere...

@Alexey Matveev ,

I try to execute the script in your example, but it gives an error:

Exception while executing SIL program >>null<<: [SIL Error on line: 1, column: 14] Project component is null!

Script:

if(isNotNull(admGetProjectComponent("VTBTOP", "TEST"))){
admAddProjectComponent("VTBTOP", "TEST", "Verify the addition of components.", "",0);
}

What could be the mistake?

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2020
Helen Porter
Contributor
July 13, 2020

Hello @Alexey Matveev ,

Thank you!
But I don’t understand how to write a condition to search for a specific component? For example, we need to check for the presence of a component called Test in the JIRASUPP project.
How to make a condition for the design:
if( ){

}

?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 13, 2020

@Helen Porter 

if (IsNotNull(admGetProjectComponent("JIRASUPP", "Test"))) {

...

}

Helen Porter
Contributor
July 15, 2020

@Alexey Matveev ,

I try to execute the script in your example, but it gives an error:

Exception while executing SIL program >>null<<: [SIL Error on line: 1, column: 11] Project component is null!


Script:

if(isNull(admGetProjectComponent("VTBTOP", "TEST"))){
 admAddProjectComponent("VTBTOP", "TEST", "Verify the addition of components.", "",0);
}

What could be the mistake?

Suggest an answer

Log in or Sign up to answer