TEXT: %0KmBx2 s 1=$O(^|%objcsd(%qHandle,5)|CB(1,1))

this cannot be right. the solution to the $O is always a variable starting and ending with (null-"")

your comment was:

If I make that "1" a variable (and set it to {L2}) and set an invalid condition {L2}'=1 then I do get this table to compile and work but I don't think that should be necessary.

also the $O() terminates with null so {L2}'=1 looks wrong ie {L2}'=""

the ref; <Invalidcondition name=..L2

this does say NAME ie a variable

I do not do mapping, but your definitions appear to break the rules

What a night mare.

W $zd($h,15) =09/08/2023

w $zd($h,1)=08/09/2023

How do you know the which country the end user is in

08092023 is very bland

The Only international  standard is used by the air lines

Imagine a ticket with such a date 08092023 this would be fraught with mis understandoing

w $zd($h,2,,4) = 08 Aug 2023 this is recognised the whole world over

hdate=$zdh(%d,2)

however
set Date=$tr($zd(%d,1),"/","") or
set Date=$tr($zd(%d,15),"/","")

depending on your calendar

Danny

You did not say why the user log out does not clear the licence slot use. I found this problem when using CSP Pages. Once evoked the licence stands and holds throughout the Grace period. hence a denial of service!!

so my question was: how can I control the Logout or migration away from my server, without leaving the licence active.

My Solution that solved ALL my problems was to add a Frame to hold the csp pages.

<body onBeforeUnload="Terminate();" onload="setpage();" >
<div  >
  
    <iframe name="topleft" id="topleft" src='#(..EscapeHTML(..Link("rCompanyStaffWelcome.csp","",1)))#
     style="position: absolute; overflow: hidden;"
     frameborder="0" scrolling="yes" width="#(LeftSize)#height='850px' align="left">
    </iframe>     </div>
    
 <div   >
  <iframe name="topright" id=topright src='#(..EscapeHTML(..Link("RightPage.csp","",1)))#
  frameborder="0" scrolling="yes" width="#(RightSize)#align="right">
    </iframe>
</div>  
 
</body>
</div>  
 

The Trick is in the :

<body onBeforeUnload="Terminate();"

<script language="JavaScript">
<!--
function Terminate() {
 tmp=#server(..Remove())#;
  }

<script arguments="" language=Cache Method="Remove" >
$G(%session.Data(0,"User"))="" 1
set z=##class(abc.system.objUserHistory).Logout(),%session.AppTimeout=3
quit 1
</script>

All my Csp pages create at least on single frame. -- onBeforeUnload -- forces the session to a 3 second timeout. long enough for the web session to die without generationg an error message.

In my case I am messuring the time of the session, so I need to Logout to complete the record. The User tag will always exist if the user has a licence. if not the livence has already been released.

Also My Timeout code within the web page is 5 seconds short of the Users inactive allowance. Thus the paage will logiout on its own accord.

Notice the single frame stands thougout the life of all the application webpages - all 3000 of them. One line of code in one place controlls everything. You cannot close the browser, navigate away or timeout without a Termination().

Port no is 22 for sftp

below is my code

ClassMethod ConnectSFTP(TargetServer As %String, Username As %String, Password As %String, TargetFolder As %String, FilePath As %String, PortNo As %Integer) As %String
{
set pcs=$l(FilePath,"\"),FileName=$p(FilePath,"\",pcs)
set stream=##class(%Stream.FileBinary).%New()
set From = ##class(%File).%New(FilePath),sc=From.Open("RU")
  set sc=stream.CopyFrom(From)
;--------------------
set ssh=##class(%Net.SSH.Session).%New(),sftp=""
set Status1=ssh.Connect(TargetServer) if Status1'=1 quit "No Connection"
set Status2=ssh.AuthenticateWithUsername(Username,Password) if Status2'=1 quit "Not Authenticated"
set Status3=ssh.OpenSFTP(.sftp) if sftp="" quit "Failed to create the sftp object"
set Target=TargetFolder_"/"_FileName
set Status4=sftp.PutStream(stream,Target,,0) ; 0777=everybody
if Status4'=1 do  quit "Failed to Transfer file"
.set NO=$i(^abcErrorTrap(0)),^abcErrorTrap(NO,1)=Status4,^abcErrorTrap(NO,2)="SFTP"
.set ^abcErrorTrap(NO,3)=Target
.set ^abcErrorTrap(NO,4)=FilePath
.set ^abcErrorTrap(NO)=$zt($p($h,",",2),2)
set Status5=sftp.%OnClose()
kill sftp,stream,From,ssh
quit "Successful"
}

Not sure what you are really trying to do here. Who is going to read this file.?

However: I see this as two parts

First Method: you create a Template of an Array Name, as indicated. Then create Part 2 The second Method: Create/open a %Binarystream File and copy the Array data into the stream from the Known array (Always using the same Array Name) and then save the file.

Since the content of your now Standard Named Array may have a varying level of nodes, use the $Q command to advance through the unknown array levels and save both the level Nodes and the values into the file.

This means you create the Named Array, populated by any number of levels of data, then pass this to the 2nd method to actually populate the physical file.

This is the old technology, which raises the question, what problem are you actually trying to solve? Is this really the best solution.?

I have been creating full blown Excel files for years. I am not sure what our comment 'Filter' means.

My concept is that I have a library of code that reads a template of data that creates the Excel file. Thus all my Report codes generate the Templates then evoke the Excel generator. There is only one generator thus only one place to make any changes that might be inherited from Microsoft.

So can you restate you querey. what are you lookig for?

Property cAge As %String(TRUNCATE = 1) [ Calculated, SqlComputeCode = {set {cAge}=0 if {dDateOfBirth}>0 set {cAge}=$ZD($H,8)-$zd({dDateOfBirth},8)\10000 }, SqlComputed ];

This code turns my date of birth (+$h style ) into age

I use to find the age of animals in my competitions. as they return year on year. but the Date of birth is constant.

There appears to a confusion and understanding between a ClassMethod and a Method

your code ret=zenPag.getSessionValue()

looks like a Method as it is dependant on the object zenPage existing.

A ClassMethods can be called from anywhere thus must be identified in full

##class(ClassName).ClassMethod(Params if any)

getSessionValue must be a method with the zenPage Class structure.

You do not disclose the Class object that hosts the method1 of the onloadHandler so these may be ClassMethods

But Not the zenPage.getSessionValue() this defines a Method.

The Idea of a one to one is to create a property of the class in each other.

The SQL will allow you to build any table by displaying the ID (not the object)

A Many to Many will not allow the SQL to work

Thus

Class one has a property

Property objPointToTwo as  Classname;

Class two has a propery

Property objPointToOne as Classname;

The %Resultset will allow

select ID,objPointToTwo

from ClassName


var xhttp new XMLHttpRequest();
        xhttp.onreadystatechange function (obj) {
           if (this.readyState == && this.status == 200) {
             window.obj JSON.parse(this.responseText);
              window.obj.Landing.ReplyRoute=xhttpRpl
              window.obj.Landing.Invite=Invite
               AddHostName(window.obj)
            }
        }
Invite=window.location.href.split("=")[1]
route=window.location.href.split("=")[0]
part=route.split("/");
part1=part[0];
part2=part[1];
part3=part[2];
part4=part[3];
//
// http:/ / ip csp
UrlRoute=part1+"/"+part2+"/"+part3+"/"+part4
var xhttpUrl=UrlRoute+"/smartrest/RsvpSpecial?Invite="+Invite
var xhttpRpl=UrlRoute+"/smartrest/RsvpActivity"
         xhttp.open("GET",xhttpUrl, true);
        xhttp.send();
 

There are two issues here

The xhttp is triggered to wait for the traffic to be completed,

xhttp.onreadystatechange function (obj) {
           if (this.readyState == && this.status == 200

There are four changes of state. the 4 means competed. then the Next Fuction can be called to populate the data that has just been uploaded.

The next problem for me. was that the data is out of scope. thus the 'window.obj'

The reply Post:

var ReplyString=JSON.stringify(objReply)
var xhttpRpl=obj.Landing.ReplyRoute
var xhttp new XMLHttpRequest();
xhttp.open("POST",xhttpRpl, true);
xhttp.setRequestHeader('Content-type','application/json; charset=utf-8');
xhttp.onreadystatechangefunction() {
if (this.readyState==='4' && this.status==='200') { return true;}
}
         xhttp.send(ReplyString);
}

Roll back is an issue that is often hard to track. When I have encountered it it is caused by the same object being opened twice where a further save of data will compromise the other instance (within the same session). hence the rollback. You can generally prove this by watching the ID of the class. as the data is rolled back it takes on a new ID. Once you can identify this you can refocus your attention to track down the the logic flaw.

William

As usual it depends what you are trying to do.

Cache passwords may take care of themselves but I have a Web Portal that does not use the cache logon process.

I save the HashEncryption in the string property. As Far as I know this cannot be decrypted

set obj=##class(abc.portal.objPortalAccount).%OpenId(PortalAccountId)
set obj.sPassword=##class(abc.util.Encryption).HashEncryption(Password)
set sc=obj.%Save()

On the next login I encrypt the entry field and compare to the original established version.

When the Web user estabilshes his account, he enters the Email address that I need to prove.

I return an email to that address with a url and a coded string to continue with the challenge.

set Return=##class(abc.util.Encryption).Base32Encode(Return)

This can be decrypted within  the web page when it is retuned attached to the URL and this allows me to validate the retuning process.

set Return=##class(abc.util.Encryption).Base32Decode(Return)

Once all this has been extablished I invite the users prefered Password and save it with the HashEncryption it then becomes non readable.

Hope this helps.

Laura

I have a dll that creates an Excel document

I would be delighted to help you debug your word dll.

I have been using activate for years. but when the 64 bit Cache was lauanced the 64 bit link did not work with the activate wizard. ( this is now fixed in the 2016.2 version)

So I was forced to created the .net dll

My original problem was that there were too  many parameters. so I added a top level dll to simplyfy the call

The Cache Studio allows you to chain these dll(s) go gether.

I also used the viual studio to create this module. and it is in constans use.

Since your version is not working yet may I offfer some advice for your consideration.

Embed all the commands with a single common library. in this way all your 'File Generation' code call will be a single source. in this way you will have only one place to expand or correct any problems.

All my reports are in excel spread sheets. Thus all these report generating routines build a common template

at the very end of the code each calls a common code with evokes all the file creation processes.

The younger developers know how to populate the template for with the reporting cache software, but they have no need of the knowledge on how to transfer this template into an actual file.  The system does this for them. Thus the maintenance of the library is entirely independent of all these reports. Thus if in the future Mircosoft or Intersystems change the rules there is only one place to go and fix the change

I have extended this further. When I call the template I first check the Cache version. if it is a 32 bit code I pass the template through the Activate channel for both Word and Excel. If I am running a 64 bit Cache version I pass the templaye to the Dll version.

If you think we have common email me