question
stringlengths
19
6.88k
answer
stringlengths
38
33.3k
Problem Statement: An ODBC System DSN is configured and connects successfully to a SQL Server database. However when adding that as a linked server in SQLplus, the following error occurs: Linked server from SQLplus: Failed to connect to link MyLink: Login failed for user . The user is not associated with a trusted ...
Solution: Usually this problem happens when attempting to connect using domain credentials. Instead define both the ODBC DSN itself and the link within SQLplus referring that DSN using credentials for a local SQL Server user that has rights to the database. Keywords: References: None
Problem Statement: Query currently executing in an IQ task is not completing so it is not allowing the remaining scheduled queries in the queue to execute at the scheduled time. There is a need to stop the current query and then have the IQ task continue processing. Sometimes the queue needs to be 'flushed'. This
Solution: shows how to do that.Solution To see what the TSK_IQ# is actually executing, right click on the task record and select Properties, select the external task tab. It will display what is currently executing and what is next in the queue. Normally these will be empty. You can stop the query that is currently exe...
Problem Statement: Tags in Aspen InfoPlus.21 can have history stored at different times and frequencies. Even for tags scanned at regular intervals, data compression stores history at irregular intervals. How can you normalize historical time stamps for tags for easy comparison and analysis?
Solution: The Aspen SQLplus HISTORY pseudo table presents Aspen InfoPlus.21 historical data as if it were stored at regular intervals. This sample query illustrates using the HISTORY pseudo table with full joins and without using temporary tables to display historical values as if history was collected at one minute in...
Problem Statement: When a SELECT query involves the use of the AGGREGATE function, the GROUP BY statement often needs to be added. The result return does not return in the order in which the tag names are specified. In fact, it seems to have perform an ORDER BY in ascending order for the column specified first in the G...
Solution: This issue can be work around by declaring a TEMPORARY TABLE as can be seen in the screen capture below. Instead of listing out the tag names in the Aspen SQLplus SELECT query, a SELECT query can be used to query from the TEMPORARY table. SELECT a.name, ip_description, max1 FROM MODULE.X AS t LEFT OUTER JOI...
Problem Statement: On the Aspen InfoPlus.21 (IP.21) server, TSK_SQL_SERVER listens on a socket (usually 10014) for any SQLPlus client trying to connect. Once a client connects, TSK_SQL_SERVER spawns a Windows process called SQLplus.exe to service the SQLPlus client. One SQLplus.exe process will be started for each clie...
Solution: The following two queries do just that (NOTE: the query assumes your SQLplus service is named like Sqlplus. If your SQLplus service is named differently, you would need to substitute that name into this query): Query 1: select substring(3 of line) as Local Address, substring(4 of line) as Foreign Address from...
Problem Statement: This
Solution: provides a summary of statements and examples on how to manage permission for a group of records using Aspen SQLplus. For further details about it please consult Adding Record Level Security or Removing Record Level Security topics in Aspen SQLplus Help File. Solution There are three main statements that are ...
Problem Statement: How do you modify the database parameters from SQLPlus on a client that does not have the Administrator installed?
Solution: Using the SYSTEM command, run the setdbparam.exe file in the SETCIMCODE directory. There is help available via the command line: C:\Program Files\AspenTech\InfoPlus.21\db21\code>setdbparam ? Usage: setdbparam [-timeoff=<time offset>] setdbparam [-dbsize=<db size>] [-numrecs=<# records>] [-inconly] <time offse...
Problem Statement: An SQLplus 'System' command executes an Operating System Command such as DIR, or such as execution of an EXE or BAT file - just as if you were executing it at the DOS or Command Prompt. If I am running the SQLplus Query Writer on the same PC as IP.21 is running, and my query contains a System command...
Solution: The answers are: 'By default', the 'System' command will execute on, and look for files on, the PC to which you are connected - NOT the remote PC from which you are running Sqlplus Query Writer, When any remote PC is used, the directory MUST HAVE SHARED ACCESS There is a way to over-ride the default Let's try...
Problem Statement: Can I stop and start Aspen InfoPlus.21 tasks using Aspen SQLplus queries?
Solution: This knowledge base article describes how to stop and start Aspen InfoPlus.21 tasks using Aspen SQLplus queries. Aspen InfoPlus.21 is shipped with a command line utility (tsk_client.exe) for managing Aspen InfoPlus.21. This utility is located in Program Files\AspenTech\InfoPlus.21\db21\code. Using this utilit...
Problem Statement: If an SQLplus client is attempting to connect to an unresponsive or powered down SQLplus server, the client can take a (seemingly) long time to return a no connect error. However, it is possible to minimize the timeout period by adjusting TCP/IP registry settings. The following Tech Tip provides dire...
Solution: The timeout period for connecting either the Query Writer or Desktop ODBC to an SQLplus server is partially controlled by the registry setting TcpMaxConnectRetransmissions. This parameter specifies the number of times the server will attempt to retransmit a connection acknowledgement before aborting the conne...
Problem Statement: What Aspen InfoPlus.21 tasks are the ProcedureDef records run on? Are these records run by a single Aspen InfoPlus.21 task?
Solution: The Aspen SQLplus product uses external TSK_IQ tasks (i.e. tasks that start an occurrence of the C:\Program Files\AspenTech\InfoPlus.21\db21\code\iqtask.exe executable) to run queries and procedures. Stored Procedures are always executed on the same task as the query that calls them. For example, if a QueryDe...
Problem Statement: How to find an InfoPlus.21 record's folder and the various sequence of parent folders.
Solution: This example will return a string with the name of the record and the folder structure. Function FolderTree(n1 record) local tmp string; tmp = '/' || n1; n1 = (SELECT name FROM Folderdef WHERE record_name = n1); WHILE n1 IS NOT NULL DO tmp = '/' || n1->name || tmp ; n1 = (SELECT FOLDER_PARENT FROM Folderdef...
Problem Statement: Is there a way to use SQLplus, either in the Query Writer Tool or via ODBC, to connect to an Excel spreadsheet while the spreadsheet is open and avoid this error: failed to connect to link....it is already opened exclusively by another user or you need permission to view its data...
Solution: Make the Excel Workbook shared. To do this: 1. Open the workbook in Excel. 2. Selected Tools/Share Workbook... from the menu. 3. Check the Allow changes by more than one user at the same time box. 4. Click OK. SQLplus will them be able to read the spreadsheet even if it is open by some...
Problem Statement: Can parameters be passed via the IQ or IQNP commands?
Solution: Yes, they are passed just like standard DOS parameters to a *.bat file. See the following example: Create a file C:\temp\query1.sql that contains: select &1, ip_description from &2; Use this command in a DOS box: C:\>C:\Program Files\AspenTech\InfoPlus.21\db21\code\iq.exe C:\temp\query1.sql name atcai returns...
Problem Statement: Is it possible to subtract a large number of days from a timestamp value?
Solution: You can subtract (or add) values from a timestamp in SQLplus by subtracting the value in 1/10 second intervals. So to subtract 1 day this would be 1*24*60*600 (1 day * 24 hours * 60 minutes * 600 tenths seconds). For example: local dayvalue int; local t1 timestamp; t1 = '01-Mar-14 10:25:30.1'; dayvalue = 35...
Problem Statement: When executing an SQL script, the following error messages may appear: Invalid TIMESTAMP value YEAR field out of range when converting CHARACTER to TIMESTAMP Invalid timestamp <timestamp>, check format is YYYY-MM-DD HH:MM:SS and numbers are in range All of these error messages indicate a problem with...
Solution: Check on the version of Aspen SQLplus used. ISO timestamp formats are only supported in v6.0 and above. A query using ISO timestamp being executed on a pre-v6.0, will result in error messages. Ensure that Aspen InfoPlus.21 database and the SQL script are configured with the same time setting. To check the tim...
Problem Statement: The EXECUTE and EXEC commands allow you to execute queries on remote nodes. The remote query appears in single quotes following the EXECUTE or EXEC command. If the remote query is long or is complex, it can be difficult to handle in the Aspen SQLplus query writer. This
Solution: describes how to work around this problem.Solution Knowledge base article 138104 describes how to split a long EXECUTE command over several lines. You can also place the command into a text file and read the query from the file as follows: 1) Save the query in a text file, for example C:\Temp\MyQuery.txt 2) U...
Problem Statement: An enhancement was requested to add the ability to convert a time interval to 10ths of a second. There were two suggestions for how to do this - one using a new variable type and the other using a function call. Sample of code using a variable type (interval): local ti1 interval; local tix1 integer; ...
Solution: Time intervals in tenths of seconds can be stored in integer variables and formatted as time intervals. The CAST function with the DT12 format can do what the proposed itvstr and stritv functions would do. Sample code using existing capabiltiies: local ts char(20); local ti integer; -- interval to string ts=...
Problem Statement: Having problems querying Selector Record Text Information from SQLPlus.
Solution: Check the Integers sent as character check box on the Advanced page of the ODBC data source setup. If this box is not checked it causes the select record values to appear as integers. After checking the box, you would need to start a new SQLplus session. In other words, restart the Query Writer (if that is wh...
Problem Statement: How can you display the ASCII state of a record defined by IP_DiscreteDef when querying the History table?
Solution: Using the syntax HISTORY(n) means that you want to display an n-character field from the history pseudo table instead of a number. For tags defined against IP_DiscreteDef, the character formatting comes from the field IP_VALUE_FORMAT. For example, the query select ts as Trend Time, value as Machine Status rig...
Problem Statement: What is the meaning of the '80' parameter in SELECT ts, value FROM HISTORY(80) WHERE name='mytextdef';?
Solution: When documenting the use if the HISTORY pseudo-table, the Aspen SQLplus help file says: The history table can also be used to return character data by specifying the maximum column size as a parameter. Example: SELECT ts, value FROM HISTORY(80) WHERE name='mytextdef'; Although the help files indicates that ...
Problem Statement: How to query remote databases using Aspen Technology SQLplus product
Solution: A remote database can be queried using SQLplus. I will use as an example, a Setcim database. The remote database has to be set up as a datasource. This can be done by doing the following: 1. Go into Start/Settings/Control Panel/ODBC Data Sources... 2. On the ODBC Data Source Administration dialog ...
Problem Statement: You want to retrieve all tags contained in a specific folder in Aspen InfoPlus.21 Administrator with an SQLplus query.
Solution: Use the following query and modify it as needed: SELECT record_name AS Tag Name FROM FolderDef WHERE FolderDef.name LIKE 'your folder name'; Where your folder name is the name of the folder in InfoPlus.21 Administrator that the tags are in. Keywords: Folder Query InfoPlus.21 References: None
Problem Statement: Can you change the port of the SQLpluswebservice?
Solution: You can change the port of the SQLplusWebServce by changing the port number in the line below. DRIVER={AspenTech SQLplus};HOST=hostname;PORT=portxxxxx Located in the Web.Config file located in the C:\inetpub\wwwroot\AspenTech\SQLplusWebService\ You can edit this file with Notepad in Windows. Keywords: SQLplus...
Problem Statement: When a query that has some local variables defined is executed requesting data from a remote database one might receive the following error: SQLplus - Info Remote database error on link xxxxx: [Oracle][ODBC][Ora]ORA-00904: invalid column name at line xx
Solution: This error message usually indicates that Aspen SQLplus sees the local variable as a column in the remote database table. As there will not be any tables with the name of the local variable defined it fails with the error message as shown above. So, If a remote query uses a local variable, the 'LOCAL' keyword...
Problem Statement: An SQLplus query would typically be run against a specific InfoPlus.21 database, and either return data from, or write data to, that same InfoPlus.21 database. However, it is possible to run a query against a specific database, but all or part of that query is rerouted to another InfoPlus.21 database...
Solution: describes how to set that up.Solution Let's imagine that you are running a query against a database running on a system called PROD1, but you want part or all of that query to be rerouted to a database running on a system called AFAR1:- On system PROD1, go to Control Panel => Administrative Tools => Data Sour...
Problem Statement: How can I move Aspen Calc calculations into schedule groups using an Aspen SQLplus query?
Solution: In Aspen SQLPlus use the View / Keywords: Aspen Calc Aspen SQLPlus AddScheduledItem DeleteScheduledItem References: s... menu option to add a reference to CalcScheduler: Click the Ok button and copy the following code into the query writer to move all calculations in the folder specified in the variable Folde...
Problem Statement: The below error message is encountered in Aspen SQLplus Reporting when running the report interactively.
Solution: By default, the value for the execution timeout for ASP.NET Web Application is 110 seconds in ASP.NET 2.0. This can be viewed in the web.config.comments file in the %systemroot%\Microsoft.NET\Framework\versionNumber\CONFIG. If the ASP.NET Web application is to take longer than 110 seconds to execute, the exec...
Problem Statement: Is it possible to control the directory where ProcedureDef code is stored?
Solution: Yes - The environment variable COMPRESS_SOURCE points to the folder storing containing source files for ProcedureDef, ViewDef, and CompQueryDef records. By default the code is stored in ...\AspenTech\InfoPlus.21\db21\group200\sql (From V7.2 onwards this folder can reside in different locations. Consult KB art...
Problem Statement: Customer creates a text output file from an SQLplus query and then can't find it. Or tries to open a text file and gets a File not found message.
Solution: The key here is to remember that SQLplus runs on the server machine. A customer most often will be working on a client machine. So if they are looking to open or create a file on their C: drive, they may be using code such as: SELECT LINE FROM 'C:\temp\inpfile.txt'; or SET OUTPUT 'C:\temp\report.txt'; However...
Problem Statement: IO_VALUE_RECORD&FLD not recognized by Aspen SQLplus.
Solution: This is because the IO_VALUE_RECORD&FLD field is formatted as a field pointer and the ''&'' is a reserved character. In order to extract information from this field, it needs to be handled differently than other fields in the repeat area of the transfer records. You will need to use double & (i.e. &&) and put...
Problem Statement: Is it possible to extract field data from a certain occurrence number from tag history?
Solution: Yes it is. The correct syntax to extract the nth occurrence in the history repeat area of a tag is: SELECT ip_trend_value[n], ip_trend_time[n], ip_trend_qstatus[n] FROM IP_AnalogDef WHERE Name='Tag'; Keywords: References: None
Problem Statement: Some third party SQL functions may not be recognized by Aspen SQLPLus. For example if attempting to query an ORACLE data base from Aspen SQLPlus using the to_date command the query will fail with an Unknown Function error.
Solution: The EXECUTE command executes a general statement on a link. The statement does not need to be supported by Aspen SQLplus and can be specific to the particular database type. The EXEC command executes a general statement on a link and returns a result set. Example: EXEC 'SELECT ip_input_value WIDTH 80 FROM d-i...
Problem Statement: When Report Format under the Report Properties is set to Excel, the email received does not contain the automated report. When the Report Format is set to HTML, there is no such issue.
Solution: This problem is due to Microsoft Excel not being installed on the Aspen SQLplus Reporting server. This can be confirmed by browsing to the folder C:\Documents and Settings\All Users\Application Data\AspenTech\SQLplus\output. In this folder, HTML reports (.htm) can be found but no Excel reports (.xls) will be ...
Problem Statement: What are the Aspen Cim-IO Store & Forward startup command line arguments and how to use them?
Solution: Aspen Cim-IO Store & Forward provides several command line arguments. Two of these arguments are specified when calling the cimio_sf_start.bat, the others must be hard coded into the bat file. For ease of understanding they are split into 2 headings Named and Unnamed. The command line arguments for each Store...
Problem Statement: You can read historical values at specific times using SQLplus using the HISTORY pseudo table, but it returns NULL if there is no data in history newer than the time requested. For example, with data at 12:00 and 13:00, data can be retrieved at 12:30, but no data will be returned at 13:30. Is there a...
Solution: In the documentation it mentions that REQUEST is an integer column that is used to specify the type of data returned. REQUEST can take the following values: 1 = TIMES request (evenly spaced data). 3 = FITS request 4 = VALUES request (actual recorded data). The HISTORY table in SQLplus uses the RHIS21DATA call...
Problem Statement: It is sometimes necessary to determine via SQLplus which record has a particular record ID, or RECID. RECIDs are used throughout InfoPlus.21 & the associated API calls.
Solution: The easiest way to construct such a query is to draw on the all_records table for the RECID. The all_records table contains a list of all records which exist in the InfoPlus.21 database. Using a query which incorporates this table works because every record in the database has a RECID. Indirection must be use...
Problem Statement: If you want to read the lines from a text file that has more than 80 characters on one line, and you use the following Statement Select line from <TEXTFILE> The lines are cut off and only the first 80 characters are shown as output.
Solution: The SELECT statement reads the whole line but visualizes only the first 80 characters. To solve this problem, you will have to include a FOR Statement and change the query into: For (Select line as MyLine from <TEXTFILE>) Do Write MyLine; End; Keywords: textfile select References: None
Problem Statement: Why am I seeing an error message when using SQL+ to REVOKE rights to users or roles in Aspen Framework? The error message states: REVOKE failed: Invalid role name encountered at line 2
Solution: This error is reported because it is only possible to REVOKE security on a record that has it applied. To circumvent this issue either ensure the record/role is valid or GRANT rights first. Keywords: REVOKE Invalid role name References: None
Problem Statement: How can a query check if a value exists in history before inserting a value into history?
Solution: Use the function NOT EXITS to check if a select statement does not return anything as in the following example: if not exists (select ip_trend_time from ATCAI where ip_trend_time = '30-AUG-12 09:00:00') then insert into ATCAI (ip_trend_time, ip_trend_value) values ('30-AUG-12 09:00:00', 23.0); else update ATC...
Problem Statement: When using exported models in Aspen Plus or HYSYS, some scripts are invoked automatically. Are there any templates of such scripts available?
Solution: Here is a template Presolve script that users may find useful: IfSolutionMode = then ' Running in ACM - set values for testing script ' Provide values for inlet conditions here for testing the script within ACM. These ' values are assigned automatically when in Aspen Plus End If ' Initialize values if: ' A...
Problem Statement: How to evaluate the inverse of a matrix with ACM?
Solution: ACM supports arrays, but has no predefined operators for classic operations with matrices. The following model shows how the inverse can be evaluated. model inv ns as integerset ([1:2]); // matrix dimension a(ns,ns) as realvariable (FIXED); b(ns,ns) as realvariable; // b = inv(a) for i in ns do...
Problem Statement: Fields that are formatted by selector records sometimes need to be moved to variables during processing in an SqlPlus script. When this happens, the value becomes an ordinary integer and stops displaying its corresponding value from the selector record. When it is time to write output from the script...
Solution: The easiest way to format an integer value with a selector record is to use CAST...USING. For example: write cast(2 as char using 'eng-units'); And using a variable: local eng int; eng=2; write cast(eng as char using 'eng-units'); Keywords: status level References: None
Problem Statement: While Aspen InfoPlus.21 allows 256-character tag names, Aspen SQLplus, by default, displays only the first 24 characters when selecting record names longer than 24 characters.A How can I display record names longer than 24 characters?
Solution: Use the command A A A A A A A A A A A SET Default_Record = nn; at the beginning of the query where nn is the maximum number of characters needed for your query to display record names.A Since there is not a way to change the default maximum from 24, you must execute this SET command each time you run your que...
Problem Statement: Each time the SQLplus query writer is opened, a host must be specified. A default data source is not retained.
Solution: Host information is stored in the sqlplus.ini file (located in the C:\WINNT folder). If default host information is not retained, SQLplus may be unable to access this file. The file may have been secured or set to read only. If the sqlplus.ini file is not in the default location, security may be set on the C:...
Problem Statement: This
Solution: is to assist customers who are experiencing the Connection is busy with results for another hstmt error when querying a Microsoft SQL Server Database using AspenTech SQLPlus. Solution Specific issues may arise when utilizing AspenTech SQLPlus to query a Microsoft SQL Server database. These relate to the metho...
Problem Statement: UNIX can express a time format using an integer value (for example, 1153490513). This format is not allowed in InfoPlus.21. Is it possible to convert UNIX integer timestamps into InfoPlus.21 timestamps?
Solution: Save the following function as a ProcedureDef. Function CUNIXDate(temp integer, UTC) local i VarDate; local x double; local t1 timestamp; local t2 char(32); x = temp / 86400.0 + 25569.0; i = trunc(x * 24)/24.0; t1 = cast(i as timestamp)+(x-cast(i as real))*24:00; if UTC then t2 = REPLACE( 'v' WITH 'T' IN ca...
Problem Statement: Oracle columns of data type char will only allow strings to be assigned which have the exact length. Aspen SQLplus (SQLplus) trims strings off leading and trailing spaces. Therefore, even if the SQLplus variable is defined to be the same length as the Oracle column, the two may not be equal.
Solution: The reSolution is to change the Oracle column type to be VARCHAR or VARCHAR2, 'or' use the PAD function when making assignments. For example Update oracle.batchlog set batch=PAD(local.batch to 20); Keywords: References: None
Problem Statement: Aspen SQLplus has the ability to use a 'SYSTEM' command. SYSTEM commands a user to pass something that can execute at a DOS/CMD into an SQLplus Query. Such a command might be just as simple as: SYSTEM 'dir' This article discusses the fact that the XCOPY command may have problems when executed from wi...
Solution: The XCOPY routine, when used in a query, needs to be passed as Standard Input. However this input could be null Therefore the following simple example shows the reSolution .. Change system 'xcopy D:\arcs\*.txt %TEMP%' To system 'xcopy D:\arcs\*.txt %TEMP% < nul ' Keywords: None References: None
Problem Statement: When using variable in the WHERE condition of a SELECT query to a remote table, error is encountered. Below is the error message encountered when querying Batch.21 database on Microsoft SQL Server. Below is the error message encountered when querying a database on MySQL database system. As can be see...
Solution: The query to the remote table need to be rewritten such that the variable is concatenated to the SQL query to be executed on the remote table. It will need to be executed using either the EXEC or EXECUTE command. For example, the following SQL query will result in error. DECLARE LOCAL TEMPORARY TABLE MODULE.B...
Problem Statement: Aspen SQLplus reporting provides functionality to create reports which can be sent automatically by email to a recipient list. However, if you're not using Aspen SQLplus Reporting, it is possible to include the result of a query as part of an email by creating HTML code as result of the query and inc...
Solution: provides example code on how to do this as well as a simple query which can be as template for more complex reports. This example uses the code onSolution 132567 to send email. Solution Pure HTML code for emails can be created on SQLplus by simple writing it as part of a variable which will hold the HTML body...
Problem Statement: Can you clarify what HYSYS 3.2 users need to install to use exported ACM models?
Solution: To use ACM models with HYSYS 3.2 you need to: install HYSYS 3.2 from HYSYS 3.2 CD install Aspen Plus 12.1 from AES 12.1 CD You can do this in any order. Check also for service packs and cumulative hot fixes if applicable. This will provide the core components required to use ACM models in HYSYS. You do not ne...
Problem Statement: How do I call stored procedures with no parameters from within Aspen SQLplus?
Solution: Although it is possible to define stored procedures which do not have any parameters, they cannot be called from Aspen SQLplus as it cannot distinguish a stored procedure from any other database record. To overcome this, define a stored procedure with a dummy parameter. ProcedureDef PROCEDURE TestProc(Dummy I...
Problem Statement: There is a statement in the SQLplus Online Help that says :- Important: It is recommended that you not CAST timestamp values as integer values, or timestamps as integers. AspenTech support has seen several SQL Queries that work for sometimes a long while, and then suddenly have problems due to casti...
Solution: If you want to find the time difference between two timestamp values, you should not use CAST. Instead, you should subtract the timestamp values or use the DELTA_TIME function. Example: local t1 timestamp, t2 timestamp; t1 = '11-DEC-03'; t2 = '11-JAN-04'; write t2-t1; -- Time difference as hours:minutes:seco...
Problem Statement: How to make ViewDef records to request data from the aggregate and history pseudo tables when using an ODBC connection?
Solution: In the Aspen SQLplus Query Writer write the following query: select * from history Use the Record menu and then select Save As, then save the record as a ViewDef record. Now, you can reference the ViewDef record as if it were a definition record. See the following query below for an example: select ts...
Problem Statement: The following query: local msg char (500); msg = ''Alarm for ''; FOR (SELECT Name FROM IP_Analogdef WHERE Name LIKE ''%atc%'') DO msg=msg || name || '',''; END write msg Would produce output that looks like this: Result ==> Alarm forATCDAI,ATCF101,ATCF102,ATCF103,ATCF201,ATCF202,ATCF301,ATCF302,ATC...
Solution: SQLplus char variables behave like InfoPlus.21 fields and cannot store trailing spaces. In SQLplus version 4.0 and later, there is an easy way around this. SQLplus version 4.0 introduced variant variables and these can store trailing spaces. So the query could be changed to use a variant variable rather than ...
Problem Statement: Sometimes when trying to save a query as a record in InfoPlus.21, the following error message appears: Error creating record: incorrect buffer size at line 1. The error has to do with the number of characters in the name you want to save the query under. The default number of characters in the name f...
Solution: Change the name of the query you want to save as a record in IP.21 to something equal to or shorter than 16 characters and you'll be able to save it. Keywords: buffer size Error creating record Incorrect buffer size at line 1 References: None
Problem Statement: How to access Aspen InfoPlus.21 field names via ODBC when they are invalid column names for the application (i.e. 'MESSAGE SW.' in analogdef is not valid for Microsoft Access)? Most of the definition records (i.e. ip_analogdef, ip_discretedef) have field names that consist of letters, numbers and und...
Solution: Create a view, which renames the fields, then access the view. The view can be created by running a query in Aspen SQLPlus. This will create a record in InfoPlus.21 defined by ViewDef. i.e. The following would create a view called newanalogdef: create view newanalogdef as select name, plant area as plant_area...
Problem Statement: Sometimes the TSK_IQ1 or another IQ external task seems to freeze or hang. Any QueryDef record being processed by this external task would stop executing. This knowledge base article explains what could cause this and how to rectify the situation if this occurs.
Solution: Usually, one notices that an external task is hung because queries associated with a specific IQ task fail to execute on their regular intervals. How can I determine which query caused a TSK_IQ process to hang? There exists 3 situations that can cause an IQ task to hang. These situations are: 1. A query w...
Problem Statement: What are the command line parameters for recload.exe when calling it from SQLplus?
Solution: While there isn't any help (e.g. -?) for recload.exe, it does prompt for the parameters: C:\>C:\Program Files\AspenTech\InfoPlus.21\db21\code\recload.exe InfoPlus.21 ----------- V 4.1.2.1 Copyright 1996...
Problem Statement: How to use Aspen SQLplus to control the history archive period?
Solution: For example: Can I have Aspen SQLplus switch the active archive on a particular day of the month? Answer: SQLplus can detect which day the query is executed, it can also execute system commands. The Aspen InfoPlus.21 historian has the utility 'h21shift', which forces an archive to shift. The following example...
Problem Statement: When executing an SQL script which makes use of technical tip 120388 (How can I insert data into a history repeat area using the name returned by a select statement?), the following error message is encountered. or
Solution: Below is a sample script that will return the error message shown in the above screenshots. LOCAL tagname CHAR(32); LOCAL trendTime TIMESTAMP; LOCAL trendValue REAL; tagname = 'ATCAI'; trendTime = '16-JUN-10 13:00:00'; trendValue = 1234; INSERT INTO tagname || '.PV' AS IP_AnalogDef(IP_Trend_Time, IP_Trend_Val...
Problem Statement: How can you test Aspen CIM-IO performance?
Solution: Run the cimio_t_api program and chose option G - Test Performance. This option allows the user to perform one or more test data access cycles (GET or PUT) and displays the values and/or statuses returned. This test also provides statistical information such as the average number of tags read and written per s...
Problem Statement: How can one determine the version of Aspen InfoPlus.21 by using an SQLplus query?
Solution: The following SQLplus command will return the version of Aspen InfoPlus.21: Write version(0); Here are some examples of what gets returned, depending on the version: IP.21 2006 IP.21 2006.5 V7.1 Keywords: References: None
Problem Statement: This query returns the date of the first day (Monday) of a given week in a given year using ISO standards. According to ISO, the first calendar week of a year is the one containing the first Thursday of the year. This means that Monday of the first calendar week of 2010 falls on January 4, and that M...
Solution: The attached query defines two user defined functions first_monday_of_year and first_day_of_week. The function first_monday_of_year illustrates the use of a DO...WHILE loop and the Aspen SQLplus function day_of_week. The function first_day_of_week calls first first_monday_of_year and shows how to use the Aspe...
Problem Statement: When a SELECT query involves the use of the AGGREGATE function, the GROUP BY statement often needs to be added. The result return does not return in the order in which the tag names are specified. In fact, it seems to have perform an ORDER BY in ascending order for the column specified first in the G...
Solution: This issue can be work around by declaring a TEMPORARY TABLE as can be seen in the screen capture below. Instead of listing out the tag names in the Aspen SQLplus SELECT query, a SELECT query can be used to query from the TEMPORARY table. SELECT a.name, ip_description, max1 FROM MODULE.X AS t LEFT OUTER JOI...
Problem Statement: On the Aspen InfoPlus.21 (IP.21) server, TSK_SQL_SERVER listens on a socket (usually 10014) for any SQLPlus client trying to connect. Once a client connects, TSK_SQL_SERVER spawns a Windows process called SQLplus.exe to service the SQLPlus client. One SQLplus.exe process will be started for each clie...
Solution: The following two queries do just that (NOTE: the query assumes your SQLplus service is named like Sqlplus. If your SQLplus service is named differently, you would need to substitute that name into this query): Query 1: select substring(3 of line) as Local Address, substring(4 of line) as Foreign Address from...
Problem Statement: This
Solution: provides a summary of statements and examples on how to manage permission for a group of records using Aspen SQLplus. For further details about it please consult Adding Record Level Security or Removing Record Level Security topics in Aspen SQLplus Help File. Solution There are three main statements that are ...
Problem Statement: How do you modify the database parameters from SQLPlus on a client that does not have the Administrator installed?
Solution: Using the SYSTEM command, run the setdbparam.exe file in the SETCIMCODE directory. There is help available via the command line: C:\Program Files\AspenTech\InfoPlus.21\db21\code>setdbparam ? Usage: setdbparam [-timeoff=<time offset>] setdbparam [-dbsize=<db size>] [-numrecs=<# records>] [-inconly] <time offse...
Problem Statement: An SQLplus 'System' command executes an Operating System Command such as DIR, or such as execution of an EXE or BAT file - just as if you were executing it at the DOS or Command Prompt. If I am running the SQLplus Query Writer on the same PC as IP.21 is running, and my query contains a System command...
Solution: The answers are: 'By default', the 'System' command will execute on, and look for files on, the PC to which you are connected - NOT the remote PC from which you are running Sqlplus Query Writer, When any remote PC is used, the directory MUST HAVE SHARED ACCESS There is a way to over-ride the default Let's try...
Problem Statement: Can I stop and start Aspen InfoPlus.21 tasks using Aspen SQLplus queries?
Solution: This knowledge base article describes how to stop and start Aspen InfoPlus.21 tasks using Aspen SQLplus queries. Aspen InfoPlus.21 is shipped with a command line utility (tsk_client.exe) for managing Aspen InfoPlus.21. This utility is located in Program Files\AspenTech\InfoPlus.21\db21\code. Using this utilit...
Problem Statement: When selecting from a View, the following message is given. In some circumstances, you may be seeing a Microsoft Visual C++ Runtime Library error message instead as shown below.
Solution: This is due to the usage of the ORDER BY clause in the SQL script used to create the View. ORDER BY clause is not allowed in the SQL script in View creation. Keywords: ORDER BY View Microsoft Visual C++ Runtime Library reserved word ORDER is not valid as a table expression Runtime Error! Program: C... This ap...
Problem Statement: This Aspen SQLPlus query lists all Aspen InfoPlus.21 records defined by IP_AnalogDef that are not in standard CIM-IO get transfer records.
Solution: select Name from ip_analogdef where Name not in (select cast(io_value_record&&fld as record) as tagname from IoGetDef where tagname is not null union select cast(io_value_record&&fld as record) as tagname1 from IoGetHistDef where tagname1 is not null union select cast(io_value_record&&fld as record) as tagn...
Problem Statement: What are the recommended steps for performing maintenance on Aspen Cim-IO transfer records? Performing record maintenance on Aspen Cim-IO transfer records while the records are activating could result in undesirable results. This is especially true if Aspen Cim-IO Store and Forward (S&F) is enabled. ...
Solution: Steps to perform maintenance on Aspen Cim-IO transfer records. Set IO_Record_Processing to OFF This suspends scanning for this transfer record by removing it from the scan list on the server. Record maintenance can now safely be completed on transfer record. Set IO_Record_Processing to ON This updates the sca...
Problem Statement: Real numbers with many significant digits (greater than 7), when displayed in Aspen SQLPlus, are displayed in exponential format, such as 1.23457e+007. Precision is not lost, but this may not be how you want the number to be displayed.
Solution: To display the number in true numeric format, you can use the CAST USING statement to convert the value to CHAR, and display the value with a specific format. For example: local x real; x = 12345678.912; write x; write CAST(x as CHAR using 'f22.11'); Running this gives you: 1.23457e+007 12345678.91200000047 F...
Problem Statement: Upgrading to CIM-IO version 4.9.4 on Windows NT
Solution: Shutdown the interface(s) on the CIM-IO Server Stop all of the CIM-IO tasks on the CIM-IO Client Install version 4.9.4 of CIM-IO (The same CD is used to install both the CIM-IO Server and Client). Keywords: References: the CIM-IO User's Manual. Server: Install version 4.9.4 of the CIM-IO server over the ex...
Problem Statement: Prior to V6, when using the HISTORY table to request TEXT data from records such as IP_TextDef records, it would result in the message: no rows selected
Solution: The History table can now take a parameter to indicate that the value should be returned as a character value. The value of the parameter is the maximum length (column size) of the value column. E.g. select ts,value from history(80) where name = 'TextRec1' and ts between '30-jun-04 10:00:00' and '30-jun-04 10...
Problem Statement: Is there a way using SQLplus to identify which record an external task is processing?
Solution: There are 2 functions that can retrieve this type of information. The first one is TASK_CURRENT. TASK_CURRENT(external_task_record) returns the record currently being processed by the specified external task. It returns NULL if the task is not processing a record. For example: local v_curr_rec char(10); v_cur...
Problem Statement: Can I use a query to update the oldest allowed timestamp for a list of tags contained in an text file?
Solution: The attached query UpdateXOLDESTOKfromFile reads tag names from a text file and changes the oldest allowed timestamp for a history field. The query first prompts for a text file containing one tag name per line. The default name of the file is XOldestOKTags.txt located in the Aspen InfoPlus.21 Group200 folder...
Problem Statement: This knowledge base article discusses how to print output generated from an SQLplus query to various printers on the network.
Solution: The SYSTEM command in SQLplus is usually used to call custom programs from within an SQLplus script. However, the SYSTEM command can also be used to call Windows DOS functions such as the 'PRINT' function. The PRINT function can thus be used in an SQLplus script to print a file to a printer on the network. Th...
Problem Statement: Note the results of the following query: local ts1 timestamp, ts2 timestamp; ts1 = '04-MAR-13 10:20:30.12'; ts2 = '04-MAR-13 10:20:30.13'; if ts1 like ts2 then write 'Like'; else write 'Not Like'; end if ts1 = ts2 then write 'Equal'; else write 'Not Equal'; end This query produces: Like Not Equ...
Solution: Note that = and LIKE are not equivalent.A A LIKE matches patterns and = tests for equality. Also,LIKE always compares character values and = can compare values of different data types. The default format for timestamp local variables is TS20, so using LIKE to compare timestamp local variables means that fract...
Problem Statement: Why does this query not return a character length of 5?
Solution: SQLplus truncates character strings, but not variants. By declaring x as a variant, the character length is the expected result. Keywords: variant character string char_length References: None
Problem Statement: SQLplus can be used to determine both the number of unusable records in the IP.21 database and the names of the records. The query below is an example of how this is done.
Solution: The following query will return the total number of records in the IP.21 database set to unusable followed by a list of the record names. Write DATABASE_SIZE(''unusable_records''); Select Name From ALL_RECORDS where Usable = 0; The DATABASE_SIZE function can be used with different parameters to find other u...
Problem Statement: Sometimes it may only be necessary to see the first so many records of output instead of seeing them all. For example, you only need to see the first 3 records with the highest ip_graph_maximum and the tag name.
Solution: The easiest way to accomplish this is by using the MAX_ROWS SET statement as follows: SET MAX_ROWS 3; SELECT name, ip_graph_maximum FROM ip_analogdef ORDER BY ip_graph_maximum DESC; Your results would only contain 3 rows of data including the name and ip_graph_maximum (largest value first and so on). The ORDE...
Problem Statement: This Knowledge Based article is to provide assistance to customers who are experiencing the following error during the installation of SQLplus from the Manufacturing Suite: There was a problem with configuring Aspen SQLplus Return Code is 2
Solution: If you are receiving this error please verify the following: 1) Installation is being performed with user rights sufficient to access all of the media being utilised if the media is local to the machine 2) If using network shares, ensure the user has sufficient rights to all subfolders within the AspenTech ...
Problem Statement: How to update IP.21 tables direclty from RDB remote tables in one statement
Solution: Use the following syntax update IP.21 table A, link name.instance name .table name B set A.field name= B.column name, where B.field name = A.column name For example, say you want to update the ip_value field for an IP_DiscreteDef record from an Oracle table that has two columns: TEST_CODE and PROD_ID update i...
Problem Statement: The fc (file compare) function works fine when executed from a command window but doesn't produce results when executed in the Aspen SQLPlus Query Writer. The following command works in DOS: fc samplefile1.txt samplefile2.txt In the SQLPlus Query Writer, using the SYSTEM command with fc doesn't pro...
Solution: This command doesn't show results because fc needs to redirect the standard input. Two examples are shown using redirection operators. Below is an example that will write the results to the SQLplus query window. Note that the file intput.txt has to exist prior to executing the command. If file intput.txt does...
Problem Statement: What is the Aspen SQLplus syntax to retrieve data using a WHERE clause with a date from an Microsoft Access table?
Solution: ThisSolution assumes that the correct configuration has been done for the ODBC Link which is address inSolution 107956. The query statement below will give Production History from a Microsoft Access database where the close date is after July 27, 2007: SELECT Workorder as WO, Pieces in as Amount, Date Creat...
Problem Statement: This knowledge base article explains why the following error Fail to open file $COMPRESS_SOURCE/filename.sql may occur when trying to Save or Open a query stored in a CompQueryDef, ViewDef or ProcedureDef record in Aspen SQLPlus.
Solution: There are 3 probable causes of this problem: 1. The COMPRESS_SOURCE environment variable is undefined. 2. The original (uncompressed) Aspen SQLplus query/script could not be found in the path specified in the COMPRESS_SOURCE environment variable. 3. The Source File has the Read Only attribut...
Problem Statement: IP_TREND_TIME timestamps show up as ******** in query of IP_TextDef query.
Solution: To resolve the problem, the TS20 record (defined under TimeStampFormDef) should be used for the timestamps. This can be done in two ways. The first method is illustrated in the sample query below. Select IP_TREND_TIME using ''TS20'', IP_TREND_VALUE from Test_Tag; In this example, the timestamp is displayed us...
Problem Statement: When executing SQL script in Aspen Query Writer, the following error message appears.
Solution: This is due to the use of local variable declared without specifying data type in arithmetic calculation. When a local variable is declared without specifying data type, it will default to be a variant local variable. Declare the variables in the SQL script specifying a data type for the variables using the s...
Problem Statement: The following errors may occur when attempting to create new records in Aspen InfoPlus.21. No free record ID after 2000 for INSERT or CREATE or No available record ID's
Solution: InfoPlus.21 assigns a unique internal numeric number to every record that gets created in the database. This is referred to as the Record ID. InfoPlus.21 must allocate these record IDs, which requires a small amount of memory in an internal table. It takes up 12 bytes per record ID, whether a record has been ...
Problem Statement: When starting the Aspen CIM-IO MANAGER service using Store and Forward, the Store, Scanner and Forward processes may not be started. At a command prompt, go to the %CIMIOCODE% directory and attempt to start Store and Forward: C:\AspenTech\InfoPlus.21\db21\code> :\commands\cimio_sf_start Check to see ...
Solution: The meanings of the error messages are as follows: facility=8 error=8007 INIT,8007,Error initializing CIMIO facility=3 error=3110 POLL_FIRSTTIME,3110,Error accepting connection facility=3 error=3021 ACCEPT_SOCK_CREATE,3021,Error creating an inbound socket facility=2 error=2010 IN_CREATE,2010,Error creating in...
Problem Statement: When saving a Query as a QueryDef record, the following error is raised: Failed to save to record: Source line too long.
Solution: This error is displayed because a QueryDef record limits each line of the query to 80 characters. If one of the query lines exceeds this limit, the above error results. To work around this, there are two options: Find any lines in the query text that exceed 80 characters. Include a carriage return in these li...
Problem Statement: Is it possible to call or activate one query record (for example, a QueryDef record or a CompQueryDef record) from another query record?
Solution: Yes, one may call or activate one query record from another by using the following syntax within the query: ACTTSK 'Name of record to be activated'; For example (where the record to be activated is named WeeklyReport): ACTTSK 'WeeklyReport'; Additional information about ACTTSK may be found within the SQLplus ...
Problem Statement: How to populate a variable when the result of an Oracle function is a Result Set. When the results of an Oracle function returns single variables,
Solution: # 116213 describes how to populate the local variable within Aspen SQLplus using those values from an Oracle database table. If the Oracle function returns a result set then how do you extract the needed data?Solution Place the results of the EXEC STATEMENT into a temporary table and then query the temporary ...
Problem Statement: How can you populate an Aspen InfoPlus.21 database with the minimum tag requirements using an SQLplus script?
Solution: The standard analog definition record is IP_AnalogDef. If this is the record you will be using, the minimum requirements are to choose a value format, and to turn on the history system. All other fields could be considered optional. They query below will create a series of IP_AnalogDef records, and fill in th...
Problem Statement: Is there a way to create separate Desktop Shortcut (icons) for Aspen SQLPlus that will automatically access a specific host? By design, when you open Aspen SQLPlus, it always connects to the last host that was accessed. This value is stored in the registry key. If you have many Aspen ADSA datasources...
Solution: Starting with version 6.0.1, the following Aspen SQLplus command line parameters are available. You can right click on the Desktop shortcut and add the parameter accordingly to the target path: . /ads - Specifies an ADSA data source name to which to connect . /p - Specifies the port name to which to connect ....
Problem Statement: I used below SQL Syntax to save as excel to html format.however, the html file is not readable. local XLobj, a; local i int, j int; XLobj = CreateObject('Excel.Application'); XLobj.Workbooks.Open('c:\test.xlsx'); XLobj.ActiveWorkbook.SaveAs('C:\test.html'); XLobj.Quit; XLobj = NULL;
Solution: The reason is that you missed a parameter for file format. see below modified Syntax: XLobj.ActiveWorkbook.SaveAs('C:\test.html',44); -- 44 indicates that the file format is html see below XlFileFormat and Constant Value xlAddIn 18 xlCSV 6 xlCSVMac 22 xlCSVMSDOS 24 xlCSVWindows 23 xlCurrentPlatformText -41...
Problem Statement: Aspen SQLplus clients receive unexpected Access Denied messages perhaps after rebooting the Aspen Local Security or InfoPlus.21 server.
Solution: Try removing and re-adding the SQLplus securable object using the AFW Security Manager. Keywords: None References: None