Questions tagged [sqr]

SQR is a high level language like Basic but with built in SQL capabilities - it became very popular with PeopleSoft in the early 90's and is still a mainstay of that product. It can run on many platforms and use many databases

SQR is a programming language designed for generating reports from database management systems. The name is an acronym of Structured Query Reporter, which suggests its relationship to SQL (Structured Query Language). Any SQL statement can be embedded in an SQR program.

Features

SQR is notable for its powerful database and printing functions. It can embed any SQL statement almost anywhere in a program. There is a version of SQR that can use multidimensional databases like Essbase. It can combine database reads with print instructions. It flexibly formats data breaks and page breaks. It prints variable fonts, sizes, and colors. It has a graph generation command that offers dozens of parameters for adjusting content and appearance.

The language is very easy to learn but has some nuances. It is normally compiled at run time, however, it can also be pre-compiled, which does save time on larger programs.

Syntax

SQR has four scalar data types. The first three are:

  • numeric (variables begin with “#”)
  • character string (variables begin with “$”)
  • and date (variables begin with “$”, same as with character string variables.).

Date variables must be declared, to be distinguished from character string variables. There is the option to declare numeric variables to specify them more precisely (integer, floating point, etc.). The last data type is a database column (variables begin with “&”). The values of database columns are set only by a SQL “select” statement; no other command can change their values.

SQR also has arrays, like those of the C programming language or COBOL. An array has one or more fields, where each field is either a numeric, string, or date variable. Each field may have multiple occurrences, giving SQR the equivalent of two-dimensional arrays. SQR has special commands that manipulate multiple items within a single array. There are many commands that cannot use an array element in place of a scalar variable.

The language has four primary control structures. The first three are:

  • if-else-end
  • while-end
  • and evaluate (like case or switch).

The fourth is the embedded SQL “select” statement, which allows SQR statements to be executed for each row of data in a loop.

SQR has commands to open, read, write, append, and close computer files. File input and output is sequential and record-oriented only; random access is not supported.

SQL Select statements are built into the language using Begin-Select and End-Select statements. It can also run native SQL for Inserts, Updates, Deletes, Truncates, etc within Begin-SQL and End-SQL statements.

Within a Begin-Select and End-Select block, each row returned from the query can be trapped and used to either print or call other procedures that may call other SQL statements (or do other logic).

It can be used to produce very pretty reports (a PDF format is an option as well as HTML and CSV formats) and can also read and write files very easily. Multi-dimensional arrays are also supported.

One of the most under-utilized features is the built-in on-break mechanism. Instead of having to manually set break-points when switching groups, this language has an on-break clause that can be attached to fields being returned from the SQL query - using these, Before and After operands allow calling of procedures. For example:

Begin-Select
    Company() on-break print=change/top-page before=Init-Company after=Process-Company Level=1
    Name () on-break print=change/top-page before=Init-Employee after=Process-Employee Level=2
    From PS_Employees
    Order by Company, Name
End-Select

This logic will break on company and employee automatically and call before and after procedures without any flags or grouping required.

SQR is a language still currently being used and it remains a top report and processing program language with PeopleSoft systems.

71 questions
0
votes
1 answer

Get number of records returned from select in SQR

I have an SQR Begin-Select statement which SELECTS a bunch of data and returns it for processing the SQR report. There is a possibility that the Begin-Select will return nothing, so that means there is nothing to report. How would I check if the…
Jimenemex
  • 3,104
  • 3
  • 24
  • 56
0
votes
1 answer

Dynamic bind variables not being recognized in inline view

I have the following code written in SQR: select business_unit &g8_iee_business_unit ledger g8_iee_ledger sum_posted_total_amt &yb_g8_iee_amount_selected ft_yb_iee_RPT_NY &g8_iee_rpt_row_ny currency_cd …
Tom Micua
  • 5
  • 1
  • 4
0
votes
1 answer

Using Unix mailto command in sqr

Good morning all. I'm having some trouble using mailto command in an SQR. Here is the command I have. let $From = ' -- -F "Human Resources Administration"' let $text = $TotCnt || ' Body ' || $prcs_process_instance || '. ' let…
Robert
  • 23
  • 3
0
votes
1 answer

SQR 5543 error. Report arguments in sqrw

I am trying to run SQRW and it asks for report arguments. I entered -ZIF"path to my pssqr.ini" (without the quotes) once I hit OK I get the error (SQR 5543) Specify the Oracle DLL name in the SQR.INI file in [Environment:Oracle] section for…
Kevin Moore
  • 243
  • 1
  • 6
  • 15
0
votes
1 answer

Is there a Python script that can execute SQR report?

I want to break dependency from Sybase sqr tool. Is there a Python script that parses *.sqr script and executes it?
olekb
  • 638
  • 1
  • 9
  • 28
0
votes
0 answers

Infinite while loop with break condition in SQR

I have this infinite loop problem in a sqr code. I have a condition that should stop it though and a the $objet is equal [4]: Here is the code: begin-procedure Extracteur(#id_document) move -1 to #index_fin_objet do Lire_ligne_suivante($objet) …
Marwen Hizaoui
  • 99
  • 1
  • 1
  • 6
0
votes
0 answers

SQL/SQR Oracle cross checking table's columns

Basically, I am writing an SQL (that will be turned into SQR) that will create a report whenever there is a change in a employee's status related to one of the sales teams. The issue I am having now is that if an employee transfers out of one of the…
0
votes
1 answer

fetched column value was truncated error in SQR File

We are having one SQR file. When I execute that SQR,I got below error. SQR 5528) ORACLE OCIStmtFetch error 1406 in cursor 1: ORA-01406: fetched column value was truncated Error on line 565: (SQR 3725) Bad return fetching row from…
Azarudeen
  • 73
  • 2
  • 13
0
votes
2 answers

nodemcu Lua sqr function

-I want to buy nodemcu board and apply the Pythagora's Theorem but I dont know if sqr function exists on nodemcu lua interpreter ? I googled on web and I found few doc with sqr() but on official Faq math funtions are omitted: -The debug and math…
0
votes
1 answer

Newlines entered in Firefox not dislplaying in SQR Report

Let's say I have a text field here named "Description". In the Description field, I entered the following text: This is line 1. This is line 2. This is line 3. When I input these text to the Description field using IE or Chrome and run the SQR…
airhalynn101
  • 81
  • 2
  • 9
0
votes
1 answer

Opening a Hyperion SQR Reporting

I have received some files with SQR extension. When I open it with Hyperion SQR Reporting tool, it shows only a script. How can we view the report layout using this script and how can we run this report. I'm not able to get a proper help doc on…
user1482807
  • 183
  • 2
  • 7
0
votes
2 answers

SQR procedure with run-time error on BEGIN-SELECT statement

Hello Stack community, I have been stuck for the past couple of days with what I initially thought was a relatively simple SQR update. In a nutshell, procedure Process-Main selects all the employees where COMPANY = 'ABC' and then I need to insert a…
Tommy
  • 65
  • 11
0
votes
1 answer

How to print a double dagger symbol in a SQR report

Is there a way to print a double dagger symbol in SQR language? I am trying to see if we can use unicode to print the same in a SQR report Any help in this regard will be helpful.
Nik
  • 142
  • 5
  • 12
0
votes
1 answer

FTP script called through SQR not working

In my SQR program, I am using call system USING $ftpCommand #sendStatus WAIT to grab a file from a FTP server. The $ftpCommand is: C:\Windows\system32\cmd.exe /c E:\PS\psoft\dev\sqr_custom\ftp_from.bat The ftp_from.bat contains one…
Jessica
  • 41
  • 1
  • 3
0
votes
3 answers

How to retrive the effective dated empid from PS_JOB table

I am new to peoplesoft. I can understand the effective date at a conceptual level, but I am still struggling with it in SQR. How do I retrieve the effective dated empid from PS_JOB table? How do I retrieve the valid empname from ps_names for the…