OK.  I know how to switch namespaces.  What I'm trying to achieve is if the user opens another tab or browser, the two sessions share namespace, but I don't want them to.  Change to NamespaceB in one, and the other changes to NamespaceB as well, without the user knowning.

 

In MgmtPortal, I can change to ENSEMBLE in one tab, but the other tab stays in DEMO.  (However, my processes all think I'm in %SYS becuase the third tab viewing the processes is in %SYS -- bug??)  Watch out - if you try to view a global in DEMO, at first it will think you're in %SYS. Try it (I'm on 2014).

 

But after that inital hiccup, MgmtPortal allows one tab to switch namespaces without changing the other tab. how? How does one do that using web applications?

I only know what to use on the COS side; you can use the %SYSTEM.Status class with methods IsOK, IsError, GetErrorText, GetErrorCodes, like this:

s returnStatus = ...code that returns %Status...

s isOK = ##class(%SYSTEM.Status).IsOK(returnStatus)

There is a shortcut:

s isOK = $system.Status.IsOK(returnStatus)

I find .GetErrorText(returnStatus) and .DisplayError(returnStatus) methods to be quite useful when I want to display the error text in an alert window or on the screen (respectively).

See the class reference for more methods.

I don't know of a utility on the Java side;  that would be nice to know. Perhaps you can call out to COS again to parse it and return a Java type.  However, the first character of a %Status is always  a 1 if it's OK, and a 0 if it's an error.

Is this what you were looking for?

Thanks,

Laura

OK, that's helpful info Eduard.  I can use Security.Applications, but in order to get the properties, such as Path, I need an Application Name.  The question is, what Application name am I actually using?  I was going to use the path in order to find the application.

 

I think you're right in that the HOMEPAGE  is causing a specific application to be used.  However, as the user switches namespaces, the HOMEPAGE appears like this: /OurAppName/newhomepage.cls.  There's no mention of the namespace.

 

This could imply that only the one Application called '/OurAppName' is being used, in which case I think a Group By Id could work.  I'll have to think about what you said though.

 

Thanks,

Laura

hi Marco,

Looks like that's what we are doing.  We have at least 4 pages in the heirarchy, and the top page inherits from %ZEN.Compone.page.  I'm not sure why it works, but our XDATA is not overwritten by the child classes.  The parent pages have the logo and the menus, etc, that are on all the pages.  Each child class has its own XDATA stuff on it too.

 

I wanted one more level of page, that contained methods as well, that child pages would use.  These methods would be run on all events, but with the child page's properties, such as "page name", or "table name".  

 

So for example I wanted a parent page with data entry capabilities to edit dictionaries.  Each child page would contain the dictionary table name and its own Save method, but most of the other methods are the same.

 

Anyway, it's too late to re-write all the pages; I was just wondering what would be the best way in the future.  

Yes, yesterday I had the same method in both the child class and th parent class.  It wasn't working in either class, but I think it was because it existed in both.  I have since removed the meothod from the child class, and this is the sig dump:

 

2
 
0000: 1D 01 06 01 70 55 52 4C 11 01 25 4C 69 62 72 61         ....pURL..%Libra
0010: 72 79 2E 53 74 72 69 6E 67 02 01 02 01 1F 01 08         ry.String.......
0020: 01 73 69 6C 65 6E 74 11 01 25 4C 69 62 72 61 72         .silent..%Librar
0030: 79 2E 53 74 72 69 6E 67 02 01 02 01                     y.String....

 

Interesting.  Looks like just the two params now, and no doubles.

 

So, child classes cannot have the same javascript method name as a parent class? Oh wait, there's no overloading in Cache, so perhaps, even though that's more like overriding, it didn't work?

 

Can we open a discussion on child class properties?  I added some to a mid-level class (it has a parent and a grandparent, and a bunch of children); when I added two properties to it, the grand-parent class was unable to retrieve a property correctly.  When I remove the properties, the grand-parent class is fine. Seems similar to having a method in a parent class with the same name as a method in a child class.

I thought it was kinda funny that the compiled javascript looked like this:

 

self.CallReasnModify_doReturn = function(silent,silent) {
  confirm('silent = ' + silent)

 

but I thought it was just how InterSystems generated it.  I changed the name of the variable to 'foo' and it then looked like this:

 

self.CallReasnModify_doReturn = function(foo,silent) {
      confirm('silent = ' + foo)
    
    

And it worked. ?  Brings me back around to a compile thing. What's the deal with the extra parameter in there?

Yes, as written it should be fine, as indicated from tests run on w3schools.com.  This should work too:

&js<var silent='1'; zenPage.doReturn(silent);>

 

but alas, the compiled code (?) is not getting it. I have not yet tried a simple zen page, but I suspect it's not the code... how do I remove the compiled code and recompile? What else is there??

Thanks for your thoughts.

Laura

No.  If the Zenmethod is a javascript method, it does not work any better.  The parameter *silent* is showing up in firebug (in FireFox) as "1", and then is immediately shown in the alert box as undefined.

 

I was rifiling through some of the demo code in 2016, but I could not quickly find an example of a Zenmethod calling a javascript method with a parameter.  All the javascript methods with parameters are called from html, not Zenmethods.

Aside from skipping the parameter, any thoughts?

Ah, yes... I'm thinking that it's an OS level authentication that is also a part of the connection, and that the "handshake" hadn't finished the first time.  I'll look into it. I would prefer not to have to keep duplicates in each namespace as I create more Productions.

 

(If you have any comments on creating Productions in separate namespaces, I'd love to hear!)

 

Thank you,

Laura

I have tried every combination I can think of:

 

//zenThis.DoDebug(); //zenThis is null
//zenPage.DoDebug(); //Attempt to call non-ZENMethod
//this.DoDebug(); //attempt to call non-ZENMethod
//%this.DoDebug(); //available only in ObjectScript
//do ..DoDebug(); //same

(I'm actually calling a DoDebug zenmethod)

It's possible that i have to compile all the child classes; I just don't want to do that yet until no one else is on the system. I can call some other zenmethod that already exists, and it can find it. Just can't find my new zenmethod, although the javascript method is available.

 

Thanks -L

David was correct in that I had to use object script to loop through the interchange (ISA segment) and the groups (GS segment). I was able to put that code right into the transform.  Since I'm on 2014.1.3 I had to add this code, rather than using the transformation to loop.

 

The code looks like this:

s GroupIn = ""
  for {
  
    s GroupIn=source.NextChild(GroupIn,source.GetSegmentIndex("GroupDocsRef",.ok))
  
    Quit:'$IsObject(GroupIn)
    s tSC =GroupIn.PokeDocType("HIPAA_5010:Group")
    s tSC=GroupIn.BuildMap()
     
    s TSIn=""
    
    For {
     Set TSIn=GroupIn.NextChild(TSIn,GroupIn.GetSegmentIndex("TransactionSetDocsRef",.ok))
     
     Quit:'$IsObject(TSIn)
     s tSC =TSIn.PokeDocType("HIPAA_5010:835")
     
     s TSOut = ""

 

The transformation that has the code in it looks like this:

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl]
{
<transform sourceClass='EnsLib.EDI.X12.Document' targetClass='EnsLib.EDI.X12.Document' sourceDocType='HIPAA_5010:Interchange' targetDocType='HIPAA_5010:Interchange' create='copy' language='objectscript' >
<annotation>This sorts the Transaction Sets from an Interchange into Groups. It also calls a transform on the Transaction Sets. Much of this was copied from the Demo.X12.SorterDTL.ByGroup.SorterTransform.dtl in the 2016 ENSDEMO namespace.</annotation>
<assign value='0' property='target.{GroupDocsRef:ChildCount}' action='set' >
<annotation>Initiate the child count in the Interchange to zero</annotation>
</assign>
<assign value='0' property='target.{IEA:NumberofIncludedFunctionalGr}' action='set' >
<annotation>Initiate the child count in the Interchange to zero</annotation>
</assign>
<assign value='##class(%Library.ArrayOfObjects).%New()' property='ArrayOfGroups' action='set' >
<annotation>Create the array of Groups</annotation>
</assign>
<code>
<![CDATA[ s GroupIn = ""
  for {
  
    s GroupIn=source.NextChild(GroupIn,source.GetSegmentIndex("GroupDocsRef",.ok))
  
    Quit:'$IsObject(GroupIn)
    s tSC =GroupIn.PokeDocType("HIPAA_5010:Group")
    s tSC=GroupIn.BuildMap()
     
    s TSIn=""
    
    For {
     Set TSIn=GroupIn.NextChild(TSIn,GroupIn.GetSegmentIndex("TransactionSetDocsRef",.ok))
     
     Quit:'$IsObject(TSIn)
     s tSC =TSIn.PokeDocType("HIPAA_5010:835")
     
     s TSOut = ""]]></code>
<subtransform class='My835Transform' targetObj='TSOut' sourceObj='TSIn' >
<annotation>Transform the transaction set </annotation>
</subtransform>
<assign value='TSOut.{BPR:TransactionHandlingCode}' property='key' action='set' />
<assign value='##class(HelperMethods).FindParents(TSOut,GroupIn,ArrayOfGroups,,key)' property='tSC' action='set' />
<code>  <-- another code snippit to finish the for loops
<![CDATA[ }
  }]]></code>  
<foreach property='ArrayOfGroups' key='tKey' >
<assign value='ArrayOfGroups.GetAt(tKey)' property='tGroupOut' action='set' />
<assign value='##class(HelperMethods).AddChildToDocsRef(tGroupOut,target,"GroupDocsRef")' property='tSC' action='set' />
</foreach>
</transform>

 

Note that it was all done using the GUI that Intersystems provides for editing a transform (in Management Portal or Studio). I copied most of the transform from Demo.X12.SorterDTL.ByGroup.SorterTransform in 2016 which I had to download to my personal computer in order to have the demo; I mostly copied the 2016 demo transform called Demo.X12.SorterDTL.byGroup.SorterTransform.dtl.

 

Apparently the looping in 2014 uses  EnsLib.EDI.X12.Document.GetNextIndex, which does not work, while in 2016 the looping uses Document.NextChild, which does work.  Hence, the code insertion in this 2014 transform.

 

I might be able to help anyone with questions about it, although InterSystems is very good at responding to WRC ticket requests.

 

Thanks go to Michael Breen at IS.

 

Laura

Hi David,

 

I'm resonding to your comment " I think this is documented "; I found the below link int he documentation, but an entire section in the documentation was copied and pasted, incorrectly.  

 

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

 

 

This part doesn't make sense: 

"Create a new Data Transformation (emphasis added because the below instructions are for creating an array of groups which is the next step)

  1. Create a new set action by clicking Add Action and selecting set.

  2.  Input a variable name into the Property field, such as ArrayOfGroups.

  3.  Input ##class(%Library.VariableName).%New() into the Value field, where VariableName is the value you provided in the Property field.

  4.  Input "" into the Key field."

but I can't quite figure out what it was supposed to be. In fact, inthe next step, Creating An Array of Groups, the steps above don't work anyway. 

 

This is basically what I was doing with my Interchange loop, which calls the Group loop, which calls the subtransform. The interchange transform runs, but I end up with the ISA line and the IEA line, and nothing else in between. Not quite true: I end up with a reference to a GroupDocsRef in between.  My output file has just two lines however.

 

Anyone else have an idea?  Any examples of an Ensemble 835 DTL transform at a transaction level that I somehow missed on the web?

 

Thanks,

Laura