Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-07-02T17:41:29Z by llandale
braolive
braolive
36 Posts
ACCEPTED ANSWER

Pinned topic Filter two diferent modules

‏2013-07-02T11:53:11Z |

Hello.

Its me again. I have write a simple dxl. He was supposed to be capable of when run in the current module apply a filter, then based on this filter, open another module and apply another filter, then print the info of both modules...

The is I wanted it to export the information from both modules to a same Excel doc. I dont even know if it is possible.

Anyway can somebody help me see here it was wrong.

Thanks. =)

 

Module mA = current

Object oA
Skip skpA = createString()
filtering off
 
Filter Saftey = (attribute "my attr" != "")
set(mA, Saftey)
 
filtering on
refresh current
 
for oA in mA do{
put(skpA, identifier(oA), oA) {
Module mB = edit("the other module path", false)
load(mB, view("the desired view"))
Object oB
 
filtering off
 
for oB in mB do {
    Filter TT = (find(skpA, (oB."Requirement tag" "")))
    set(mB, TT)
 }
filtering on
print oB."Object Text" "\n\n"
print oA."Object Text" "\n\n"
    }
}

 

  • llandale
    llandale
    2943 Posts
    ACCEPTED ANSWER

    Re: Filter two diferent modules

    ‏2013-07-02T17:41:29Z  in response to braolive

    Open module mB only once.  Open it "read".  Since you figure to load a view it must be visible (unless you cleverly search forum for loading views in invisible modules).

    • Move the following line above your "for oA in mA do" loop.
    • Module mB = read("The other module path", true, true)  // true=visible; true=load Standard View

    Be sure to assign the current module before your "filtering" command:

    • current = mB
    • filtering off

    [1] Filtering.   If I read this correclty, you want to display those oB objects that contain  "Requirement Tag" of any displayed oA Identifier.  That is unsuitable for using a "Filter" variable, as you would need to define a huge number of such filters and "OR" them together.  Would look like:

    • (contains "AMod_123", "Requirement tag") or (contains "AMod_125", "Requirement tag") or ...

    Instead you can do a manual filter:

    • current = mB
    • filtering off
    • for oB in entire mB do
    • {  reject(oB)
    •    if (isDeleted(oB))   continue
    •    ReqTag = oB."Requirement tag"
    •    if (find(skpA, ReqTag)) then accept(oB)
    • }
    • filtering on

    Understand that an "accept/reject" manual filter is not a "Filter" and will not save in a view.

    [2] Export.  If I infer correctly, you really do not care about "filtering", but rather you want to print each A object side-by-side with it's corresponding B object.  If so, you don't care about any filter for mB.

    • for oB in entire mB do
    • {  if (isDeleted(oB))                           then continue
    •     if (oB is otherwise disqualified) then continue
    •    ReqTag = oB."Requirement tag"
    •    if (find(skpA, ReqTag, oA)) then <<<Export oA side-by-side with oB>>>
    • }

    Overall then, it seems to me this structure will work:

    • open mA, load my clever Saftey filter
    • store all oA objects
      • for oA in mA do{
      •    put(skpA, identifier(oA), oA)
      • }
    • open mB
    • Do match-up and Export code on mB as above
    • delete skpA
    • close(mB)

    -Louie