Pierre LaFay · Feb 23, 2024 go to post

Is it possible to use value for search condition like this :

SELECT p.%ID, p.name, p.street, p.city, p.state, p.postal_code,
    pn.phone_type, pn.country_code, pn.phone_nbr
FROM demo_intersystems.Person p,
    JSON_TABLE(p.phone_nbrs, '$'
    COLUMNS(
    phone_type VARCHAR(10) path '$.type',
    country_code VARCHAR(8) path '$."country_code"',
    phone_nbr VARCHAR(12) path '$.number'
    )
    )
WHERE country_code = 1

If yes, I think this might not be very efficient, as it has to interpret JSON expressions for each row in the table, without using indexes.

Pierre LaFay · Feb 11, 2024 go to post

hi @prashanth ponugoti 

To use hypps you have to install CSP Gateaway in an external apache (or nginx) web server.

This external web server can be configured for https (with let's encrypt certifcate if you need fee certificates)

The documentation for csp gateway.

Modifying internal server configuration is a bad idea because in new versions of Iris, it will not be included in the distribution.

Pierre LaFay · Feb 9, 2024 go to post

Thanks for tour answer @Prasanth Annamreddy but the problem wasn't in the Package Name 

(in ##class() the param is full className : package.class), so in my Case Bna.Utils is the package and Sql is the classs

Pierre LaFay · Feb 5, 2024 go to post

Thanks to @Ashok Kumar T & @Timo Lindenschmid 
This is working fine, and I do that but this not an answer to my questions :

  • Calling a class from another Namespace?
  • Is there a way to map a table from one NS to another?

I think this must be possible by mapping %SYS bases, but I find this not very secure, I will search more in the doc...

Pierre LaFay · Jan 12, 2024 go to post

Hi @Logan Kitchen 
 

Are your databases part of a Namespace?

If this is not the case, this is necessary to access it through the Explore>SQL tab.

You can create Namespaces in System>System Administration>Configuration>System Configuration>Namespaces.
They can use existing bases

Pierre LaFay · Jan 12, 2024 go to post

To access to a session in a remote iris instance by ssh, you must

Etablish a functionnal ssh link between your client and your server (For the rest I will call them CLI and SER)

To test this first phase from your client

ssh user@SER

after connection by ssh check your Iris Instance is running 

iris all

If yours instance is up like : 

    Instance Name     Version ID        Port   Directory
    ----------------  ----------------  -----  --------------------------------
up >IRISHEALTH        2023.1.0.229.0    1972   /usr/iris/2023.1

You can now launch a session and access a terminal :

Pierre LaFay · Jan 12, 2024 go to post

You are in the right place to have the information you want:

On this web application (https://community.intersystems.com/) you have access to
Resources intersystems on l-the left bar in community t tab where you can find a kit to start using Iris (in a container or not), I suggest you docker container for a faster setup


The learning tab will provide access to course videos
The Documentation tab to the product documentation with a search function (The documentation also includes very useful how-to sections)
The open-exchange tab offers example applications or utility classes that can inspire or save time during your projects.

And of course the community tab. The people here are all kind and will try to help you. You will also find articles full of useful information there.

So you can ask your questions as you learn.

Last but not least: Welcome to the Intersystems community !!

Pierre LaFay · Jan 12, 2024 go to post

I think you'll get a lot more help if you give the details of your error.
How do you get this error?
In what context ?
On which version of Iris or hidden ( w $ZV to obtain version information)
Furthermore, you are on the site of a volunteer community, saying hello also helps to get help.

Pierre LaFay · Jan 11, 2024 go to post

If your goal is to delete this file one time you can do it with one of theses methods :

You can delete the file by using terminal : (the sudo command set you with all privileges on files)

sudo rm /tmp/test/test1.txt

Or from an Irii terminal

!sudo rm /tmp/test/test1.txt

If not can you tell me how you create it, and give the result of this command ?

ls /tmp/test.txt -lh

or (in Iris terminal 

!ls /tmp/test.txt -lh
Pierre LaFay · Jan 6, 2024 go to post

Hi @David Hockenbroch

I think I've found another way to protect a route.
I'm not protecting the route itself, but the method it points by using [ Requires = "myResource:Use" ] on the called method:

 

/// Sample APIClass Test.Api Extends%CSP.REST
{

 XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
 {
	<Routes>
		<Route Url="/test" Method="GET" Call="Test" />
	</Routes>
 }

 ClassMethod Test() As%Status [ Requires = "myResource:Use" ]
 {
  Do##class(%REST.Impl).%WriteResponse("api method test : OK")
  Return$$$OK
 }
}
Pierre LaFay · Jan 3, 2024 go to post

I suggest you create a json object in an objectscript method and call this method with an http request from your javascript to retrieve the object

Pierre LaFay · Dec 26, 2023 go to post

I am currently developing a REST API backend and I have chosen to systematically use classes, because mixing csp files and classes seems to me to harm the maintainability of the code.
Furthermore in this case, a database backup contains everything, I don't have to worry about separate files.
This is just my opinion :)

Pierre LaFay · Dec 26, 2023 go to post

You can :

Create an abstract class with a method that successively calls:
FileCompact() and ReturnUnusedSpace() from the class SYS.Database

Then you can add in the task manager a new task (type RunLegacyTask) which calls your method

Before doing this, I advise you to make a backup of your database or a snapshot of your machine if it is a VM

Pierre LaFay · Dec 23, 2023 go to post

Thanks for this article,

Just what I need to start using python (I use Objectscript since 12 years), and examples is more efficient for me.

Pierre LaFay · Dec 21, 2023 go to post

I asked intersystems for the same question, the solution is to upgrade to 2023.3 (2023.1 has issue in error reporting in Atelier)

Pierre LaFay · Dec 21, 2023 go to post

To complete @Ashok Kumar T answer, the good way to get file content :

Set source = %request.GetMimeData("file")
        Set destination=##class(%Stream.FileBinary).%New()
        Set destination.Filename="/opt/irisbuild/output/"_source.FileName
        set tSC=destination.CopyFrom(source) //reader open the fileset result=destination.%Save()
Pierre LaFay · Dec 18, 2023 go to post

Hi Zhang,

In the portal : System/Security/Roles you can create your own role like "myUserRole".

When created you have in the role definition a tab "Sql Tables".

In this tab you can add the tables which the role can access.

If you assign the created role to a user, he can access the tables.

hardcopy of the Sql Tables Tab in System/Security/Roles (in french)

Pierre LaFay · Dec 13, 2023 go to post

You can access your elements by this way (for the example, your object is named jsObj)

w jsObj.%Get(0).thingone,!
Red
w jsObj.%Get(0).thingtwo,!
Green
w jsObj.%Get(1).thingone,!
Blue
w jsObj.%Get(1).thingtwo,!
Yellow

Caution : For dynamic array, first element is indexed by 0, not 1 like ObjectScript standard arrays

Pierre LaFay · Nov 14, 2023 go to post

Thanks Julius,

It was exactly what i needed. My goal was to copy properties from a dynamic object to a persistent object, but in dynamic object for reference, I have only id, not a ref.

So i made this : (main class)

Class Bna.Utils.DynToPersistent Extends%RegisteredObject
{

Property DynObject As%Library.DynamicObject;Property PersistentObject;

Method %OnNew(dynObject As%Library.DynamicObject, persistentObject) As%Status
{
    Set..DynObject = dynObject
    Set..PersistentObject = persistentObject
    Return$$$OK
}

Method copyDynToPersistent()
{
    set pClass = ..PersistentObject.%ClassName(1)
    Set iterator = ..DynObject.%GetIterator()
    while iterator.%GetNext(.pProp, .pValue) {
        Set pType = ##class(Bna.Utils.Common).GetPersistentObjectPropertyType(pClass,pProp)
        Set isRef = ##class(Bna.Utils.Common).PersistentObjectPropertyTypeIsReference(pType)
        if isRef {
            set value = $ZOBJCLASSMETHOD(pType, "%OpenId", pValue)
        } else {
            set value = pValue
        }
        Set$ZOBJPROPERTY(..PersistentObject, pProp) = value
    }
}

}

(utility methods) :

ClassMethod GetPersistentObjectPropertyType(pClass As%String, pKey As%String) As%String
{
	set def=##class(%Dictionary.PropertyDefinition).%OpenId(pClass_"||"_pKey)
	if def Return def.Type
}

ClassMethod PersistentObjectPropertyTypeIsReference(pType) As%Boolean
{
	if$EXTRACT(pType,1,1) = "%" { Return0 }
	else { Return1 }
}

 I think my test for reference detection can be light, but enough in my context

Pierre LaFay · Nov 13, 2023 go to post

Thanks George,

It's not what i search, I would have the type, not test if is one type.

Pierre LaFay · Aug 21, 2023 go to post

Hi Eduard,

Thanks for this utility method. I think I will use it for debugging