Thursday, September 6, 2012

Intersystems Cache Mumps Database


Compile the csp file using terminal

Do $system.CSP.LoadPage("/csp/user/mypage.csp","ck")


Question:
How can I include Caché ObjectScript variables in an alert message?
Answer:
Use #()# syntax. From inside your Caché ObjectScript method, try something like this:
 s error = "Bad password"
 &js
The QuoteJS method provided by the %CSP.Page class returns a properly quoted JavaScript string. It also correctly escapes any quotes contained within the returned result.


Q3:
How do I debug a CSP page?
Answer:
To debug CSP pages, you must check the option Tools > Options > Compiler > Keep Generated Source Code.
Open your Workspace window and add your CSP pages to the CSP folder, if they are not already there.

1àCompile your CSP and click the View Other Code icon in the toolbar (or select View > View Other Code). This lets you see the .cls and .int files. For example, the file A.CSP generates CSP.A.CLS and CSP.1.INT.

2àIn the .cls or .int file, right click the line of code where you want a breakpoint and select Debug > Breakpoints > Toggle Breakpoint (or select the line and press F9).

3àSelect Debug > Debug Target > ZEN or CSP page. From the dropdown, select the target CSP page on which the debugger will run and click OK. (If you dragged your CSPs to the Workspace window, they appear in the dropdown list.)

4àClick Go on the Debug toolbar.

For example, if you have a flow: A -> B; that is, display page A and then follow a link to page B. And there is a bug in page B, you would do the following:
Check that A.CSP and B.CSP are in the Workspace window.
Compile both.
Select View > Toolbars > Debug to open the Debug toolbar.
Select Debug > Debug Target > ZEN or CSP page. From the dropdown, select A.CSP and click OK.
Open B.CSP and select View > View Other Code to open csp.B.CLS.
In csp.B.CLS, right click the first line in the OnPageBODY() method and select Debug > Breakpoints > Toggle Breakpoint.  
Click Go on the Debug toolbar.
Page A is displayed.
Click the link that brings up page B.
The debugger stops on the breakpoint in B

3 comments:

  1. Intersystems CACHE MUMPS Interview Questions.

    ReplyDelete
  2. Question : Class method and Method Difference
    How to override a class method from a different class that is protected.

    How to pass an object as refrence and why ??

    ReplyDelete
  3. Awesome blog!....
    Thanks for sharing this blog...
    Intersystems Caché

    ReplyDelete