Topic
2 replies Latest Post - ‏2014-03-16T17:37:51Z by Wolfgang Uhr
braolive
braolive
36 Posts
ACCEPTED ANSWER

Pinned topic search link

‏2014-03-14T20:40:03Z |
Good Afternoon, 

I have a little doubt. 

In a dxl, I'm wrinting a function that sends a message only when this module is linked  only to another specific module and that the attribute Type is with a specific option. 
To this end, I made the dxl part below, but now the dxl sends me the warning message in any situation, something tells me that  the logic might be wrong, but I kind of got stuck in that line of reasoning. (see the dxl below)
I'm very wrong in my logic? Or in the function itself?

Thanks!

 

Link sourceLink 
ModName_ sourceMod
bool hasLink = false
 
 
//  for check if the requirement only has link to SOME SPECIFIC MODULE
    for sourceLink in reqmtObj->"Trace to" do {
sourceMod = target sourceLink
    
if(((fullName(sourceMod)!= "-SomeEnd") && (fullName(sourceMod) != "-OtherEnd")) && (reqmtObj."Type" "" != "Help"))  {
hasLink = true
}
 
   if(hasLink){
warningBox("The message that should appear")
}
}
  • GregM_dxler
    GregM_dxler
    162 Posts
    ACCEPTED ANSWER

    Re: search link

    ‏2014-03-15T13:38:19Z  in response to braolive

    Hi,

    Yes, I think your logic is not quite correct.

    In the if check, you are using fullName, which will include the path of the target module and will have slashes in it (/project/folder/module) and so the check for != "-SomeEnd" and != "-OtherEnd" will probably always be true.

    I'm assuming reqmtObj must be an object in your current module and not in the target module (at the end of the link).  If it is trying to be an object in the target, then the target module needs to be open first.  If not open, then the object will probably be null, in which case, the last condition would also be true.

    Hope this helps,

    Greg

  • Wolfgang Uhr
    Wolfgang Uhr
    207 Posts
    ACCEPTED ANSWER

    Re: search link

    ‏2014-03-16T17:37:51Z  in response to braolive

    Hello

    I think it is not a good idead to use "reqmtObj."Type" "" != "Help"" inside the if statement. The complexity of the statement is too high for dxl.

    Try:

    string sReqMtObj = reqmtObj."Type";
    if (((fullName(sourceMod)!= "-SomeEnd") && (fullName(sourceMod) != "-OtherEnd")) && (sReqMtObj != "Help"))  {

    Best regards

    Wolfgang
     

    Updated on 2014-03-16T17:38:08Z at 2014-03-16T17:38:08Z by Wolfgang Uhr