#Beginner

0 Followers · 499 Posts

Beginner tag unites articles and questions for those who are getting started with InterSystems Data Platform

InterSystems staff + admins Hide everywhere
Hidden post for admin
Article Mike Kadow · Sep 7, 2016 3m read

NewBie's Corner Session 25 Globals, Variables, and Arrays Part 1

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Globals, Arrays, and Variables

A thorough understanding of Globals, Arrays, and Variables is foundational for every Caché developer.

A Global may be:

Scalar (a single element), as in a Global Variable

Example of Global Variables
Set ^PERSON = "DAVID – DATA ABOUT DAVID"
Set ^PERSON2 = "MICHAEL – DATA ABOUT MICHAEL"
Aggregate (many elements), as in a Global Array. An Array combines similar elements together.
Example of an Global Array
0
0 541
Article Mike Kadow · Sep 1, 2016 3m read

NewBie's Corner Session 20 Parameters and Status Part I

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Parameters

Parameters are another name for Variables when used in passing data from one Routine to another.

Let us say we have 2 routines (RtnA and RtnB), and we want to pass 3 parameters (Parm1, Parm2, Parm3) from RtnA to RtnB.

RtnA would look like:

RtnA
                Set Parm1 = "Value for Parm1"
                Set Parm2 = "Value for Parm2"
                Set Parm3 = "Value for Parm3"
1
0 395
Article Mike Kadow · Aug 13, 2016 3m read

NewBie's Corner Session 17 New command

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

New command

The New command limits a variable's scope or range of use. In theory the New command is simple, in reality the New command is powerful and needs to be respected and understood.  In Caché ObjectScript and MUMPS an entire chapter is devoted to it.

There are three variations of the New command:

When used without variables

When used with variable(s)

When used with variables in parenthesis

New command used without variables

7
0 593
Article Mike Kadow · May 17, 2016 3m read

NewBie's Corner Session 3 More Read and Write commands & Multiple commands

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Click on the Caché Cube in your system tray and select Terminal to try out the commands.

Write command with carriage return and line feed

When the exclamation point "!" is inserted after a Write command, a carriage return and line feed combination is produced. Note in this example, that a comma separates the exclamation point from the variable "X".

Set X=12
Write !,X
1
0 589
Article Mike Kadow · Jun 20, 2016 4m read

NewBie's Corner Session 8 Not

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Click on the Caché Cube in your system tray and select Terminal to try out these commands.

NOT operator ('), single quote or apostrophe 

The "NOT" operator reverses the truth-value and is intended for numeric operands, however it can be used on alphanumeric operands.

Set X=1
Write  'X
0
 
Set X=1
If X Write "True"                               ; 1 is always true and 0 is always false
True
 
Set X=0
Write 'X                                                ; X is 0, so "Not X" is 1 or true
1
9
0 533
Article Mike Kadow · May 26, 2016 2m read

NewBie's Corner Session: 5 Operator Precedence

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Click on the Caché Cube in your system tray and select Terminal to try out the commands.

Order Precedence means the order in which mathematical operators are executed. In a Mathematical expression, you may have Multiplication, Addition, Subtraction, and Division. Which of these are executed first, second, third, etc.?

The basic Operator Precedence of mathematics is:

       Multiplication and Division has precedence over Addition and Subtraction

0
0 421
Question Scott Beeson · Feb 12, 2016

In MSSQL I think you can do something like this:

select *
from HS_IHE_ATNA_Repository.COLUMNS
where TABLE_NAME='Aggregation'

 

How can I do this in Cache SQL?

[%msg: < Table 'HS_IHE_ATNA_REPOSITORY.COLUMNS' not found>]

11
1 2388
Question Scott Beeson · Feb 8, 2016

I've searched the ObjectScript reference for any instances of Upper, Lower or Case and the only thing is a case/switch statement.  In all the documentation I can only find SQL and Cache Basic references for things like UCASE.

So how do I do this in ObjectScript?

For instance, if (ucase(dtype)="G") { }

2
0 419
Question Scott Beeson · Feb 2, 2016

I'm designing a workflow for PHR via FTP.  What I've done is create a single FTP adapter to pick up files from multiple customers.  A router then accesses a lookup table and determines if a particular customer is allowed to send a particular message type to the state.  If not, the message doesn't go out.  It seems like everyone is against this approach (other than my CEO, thankfully), including Intersystems:

5
0 374
Question Jack Abdo · Feb 2, 2016

Hi,

I created with Studio a persistent class with the following field and index:

Property DescriptionDemande As %String(MAXLEN = "");
Index IDXBASDescriptionDemande On (DescriptionDemande) As %iFind.Index.Basic(INDEXOPTION = 1, LANGUAGE = "fr", LOWER = 1);

INDEXOPTION is set to 1 for activating stemming. I'm indexing french  documents. I have set lower to 1 because I want to do non case sensitive search. 

I inserted a single french word "élément" in the field DescriptionDemande for testing purposes using this query: insert into my_table(DescriptionDemande) values(' élément')

2
1 407
Question Scott Beeson · Jan 21, 2016

So calling this lookup manually from the console works as expected:

PHR>set key = "WMMC_IMM"
PHR>w ##class(Ens.Util.FunctionSet).Lookup("BlockFeed",key)
1

However, calling it from a method with some concatination to build the key is giving me problems:

ClassMethod canSendToState(iParticipant As %String, iFeed As %String) As %Boolean
{
    set = iParticipant _ "_" _ iFeed
    w "Looking up " _ k,!
    set = ..Lookup("BlockFeed",k,"not found")
    w "x = " _ x,!
}
PHR>w ##class("Custom.MHC.Common.Functions").canSendToState("WMMC","IMM")
Looking up WMMC_IMM
x = not found
8
0 430
Question Steve Shaw · Jan 21, 2016

Hi,

I'm trying to create a Zen Report that, when rendered to PDF has a header on every page that includes some items from the group that I'm iterating over in the <body>.  I can't use <header> as that only displays once for each iteration, even if that spans more than one page, but <pageheader> seems to be independent of <body> so again doesn't work.

Cheers,

Steve.

4
0 389