question
stringlengths
19
6.88k
answer
stringlengths
38
33.3k
Problem Statement: Does the order of conditions in a Where clause impact performance?
Solution: The order of WHERE condition doesn''t usually matter. However, the order of conditions can make a difference to performance. If the WHERE clause consists of a series of conditions linked by AND, the conditions are evaluated from left to right. Evaluation stops at the first condition that returns FALSE. So it ...
Problem Statement: The CIM-IO User's Manual provides a method of estimating the disk space requirments for the store file generated when Store & Forward is activated (found in Chapter 8. CIM-IO Store & Forward). This tech tip provides the user with an SQLplus query to perform the calculation for all tags in all records...
Solution: In the SQLplus query provided, downtime is a hardcoded value for the number of hours for which a theoretical store file will be generated. The user can change the desired store time in the calculation by changing the 120 hours constant entered for downtime in the query. The user will need to add up the blocks...
Problem Statement: The purpose of this
Solution: is to outline how to solve the problem where data coming into a Setcim or InfoPlus.21 database from a Cim-IO server running VMS is timestamped differently from the current, system time. The symptoms of the problem are: The system time on both the I+.21 server/Cim-IO client (NT) are current, and the timetamp o...
Problem Statement: Error : 1114. Failed to Connect to Link IP21: Specified Driver could not be loaded due to system error 1114 当在 Aspen SQLplus 配置 ODBC OAM Connection 的时候,为什么会出现如上错误1114?
Solution: 如果系统变量没有正确的配置,那么当创建新的Oracle database的ODBC OAM Connection 的时候就会出现以下的错误讯息。 为了解决此问题,需要在系统变量 Path 中添加正确的 BIN 文件夹路径。 此问题是 ORACLE 相关的错误,而且已经记录在Oracle的文档中。 Keywords: 1114 system error ODBC SQL CN- References: None
Problem Statement: How can I send an e-mail through Microsoft Exchange 2010 using a query.
Solution: The following query sends an important e-mail through Microsoft Exchange 2010 and attaches the file dbclock.out. -- This query sents a simple important e-mail through Microsoft Exchange 2010 -- and attaches tsk_dbclock.out. local objOutLook; local itemMailOutLook; -- -- Declare objects for Microsoft Outlo...
Problem Statement: 在Aspen SQLPlus运行SQL脚本时出现如下错误
Solution: 此问题是因为在算术计算中没有说明数据类型而使用本地变量。 如果本地变量没有说明数据类型,那么默认为Variant本地变量。 在SQL脚本中可以用下列语句定义变量的数据类型。 LOCAL variable_name <data_type> Keywords: variant arithmetic failed variant CN- References: None
Problem Statement: How to display in Aspen SQLplus times independent of daylight savings time adjustments.
Solution: Remove the daylight adjustment by using the function 'time_offset'. I.e. write CURRENT_TIMESTAMP-time_offset Example: write CURRENT_TIMESTAMP-01:00:00.0 Keywords: daylight, time, offset, timestamp References: None
Problem Statement: How to select the 'ERROR_TYPE' field of QueryDef or CompQueryDef records using Aspen SQLplus?
Solution: ERROR_TYPE is an SQLplus function, so it must be encased in double quotation marks. I.e. Select Name,ERROR_TYPE from QueryDef. Keywords: error_type References: None
Problem Statement: While attempting to connect to a Microsoft Access database link using Aspen SQLplus, you may receive the error message: Failed to connect to link (hostname): Microsoft ODBC Access Driver The Microsoft Jet Database engine cannot open the file 'unknown'. It is already opened exclusively by another user...
Solution: Make sure the account used to start your Aspen InfoPlus.21 Task Service has a valid network share with proper permissions to your remote access MDB file, usually located on another server. The full path to your access file is viewable thru the ODBCAD32 tool under User or System DSN tab. Keywords: Access MDB S...
Problem Statement: Error : 1114. Failed to Connect to Link IP21: Specified Driver could not be loaded due to system error 1114 Aspen SQplus에서 ODBC OAM Connection 을 설정할때 왜서 위와 같은 1114 오류가 발생합니까?
Solution: Aspen SQLplus에서 Oracle database 의 ODBC OAM Connection 을 새로 생성할때 시스템 변수Path를 정확하게 설정하지 않으면 이런 오류 발생. 문제를 해결하기 위해서는 시스템 변수 Path에 정확한 BIN 폴더 정보를 추가해야 함. 본 오류는 ORACLE 과 관한 문제이고 이미 Oracle 문서에 기록되였습니다. Keywords: 1114 system error ODBC SQL KR- References: None
Problem Statement: The BREAK keyword is used in a SELECT statement to separate sections of the output when the value for a column changes. The sections can be separated by a whole page (PAGE), a single line (SKIP 1), or multiple lines (SKIP n). The PAGE command can also be used by itself to advance to a new page. When ...
Solution: There is a SET function called PAGE_LENGTH that must be set before producing the report. By default, that PAGE_LENGTH is set to 0 which indicates no automatic paging. Depending upon your printer, you will need to set this to some size (number of lines/page). For example, SET PAGE_LENGTH = 66; says there are 6...
Problem Statement: This query will search a specified path and convert Aspen Process Explorer .atgraphic files to XML files. The XML files can then be imported into the Aspen Web.21 Graphic Studio.
Solution: local mycommand char(150); set log_rows = 0; macro axp_path = 'C:\Progra~1\AspenTech\Workin~1\APEx\Graphics\'; mycommand = 'dir/B/A-D ' || '&axp_path'; -- reads all data files and process them one by one for (select line myfile from (system mycommand) where line like '%.atgraphic') do mycommand = 'C:\Pr...
Problem Statement: A custom application developed using the Aspen InfoPlus.21 API is not working as intended when you run it in an Aspen SQLplus query using the SYSTEM command. The application works when executed in a command prompt window.
Solution: If your application requires any sort of configuration files to be executed properly, these files have to be copied to the Group200 folder. The path can be obtained by running SYSTEM 'CD' in the Aspen SQLplus Query Writer. Keywords: GROUP200 SQL+ Database API References: None
Problem Statement: How do I make ODBC return more rows after increasing the Maximum Rows parameter in the Aspen SQLplus Advanced Setup screen?
Solution: After changing any parameter on the SQLplus Advanced Setup screen, you should stop Aspen InfoPlus.21, restart the Aspen InfoPlus.21 Task Service, and then start Aspen InfoPlus.21 again.A Alternatively, you could simply reboot server after stopping InfoPlus.21. Keywords: ODBC options Timeout Table list record ...
Problem Statement: The purpose of this
Solution: is to outline how to shutdown the InfoPlus.21 database when there are remote sessions of SQLplus running. When a remote session of SQLplus is running and a user attempts to shut down the database, the following will happen: Solution 1. In the Infomation/Prompts area of the InfoPlus.21 Manager (very botto...
Problem Statement: The ROUND function in Aspen SQLplus sometimes yields unexpected results when working with numbers having extended precision. For example, if ROUND(1.005954, 4) returns 1.006, why does ROUND(1.00595, 4) calculate 1.0059 instead of 1.006?
Solution: The reason is because computers do not store real numbers exactly. For example, internally 1.00595 is stored as 1.0059499999999999, which rounds down to 1.0059. To work around this anomaly, before rounding, try adding a small number to the number you are trying to round. For example, ROUND(1.00595 + .000001, ...
Problem Statement: How can you specify which TCP/IP port to use when creating an Aspen SQLplus ODBC data source?
Solution: By default, the TCP/IP port number used when configuring an ODBC link to Aspen SQLplus is the one specified in the ADSA Aspen SQLplus service component: To use a different port, select a data link to Aspen SQLplus from the ODBC Data Source Administrator: The following screen appears after pressing the Advan...
Problem Statement: Why is the left hand navigation bar not visible for Aspen IP.21 Process Browser or Aspen SQLplus Web-Based Reporting?
Solution: The left-hand navigation pane for Aspen IP.21 Process Browser or Aspen SQLplus Web-Based Reporting can be hidden when Internet Explorer Enhanced Security Configuration is enabled. This problem can be resolved by disabling this setting. Keywords: IE ESC navigation pane References: None
Problem Statement: Why am I getting no rows selected from AGGREGATES table query?
Solution: There are two primary reasons that a query against the AGGREGATES table may return no data. There is no tag data for the requested timespan. The range of timestamps is less than the aggregate period. For example, if the aggregate period is set as 12 hours, the difference between starting and ending timestamp...
Problem Statement: When a Stored procedure is called which accesses a remote link which is currently unavailable, the calling query fails with an error which can not be caught with a BEGIN-EXECPTION-END block.
Solution: The only method of catching this type remote query error's is to start the query which contains the stored procedure as a sub-query and place the BEGIN-EXECPTION-END block around the sub-query call. BEGIN START Record'SPQuery'; EXCEPTION ERROR ERROR_CODE, ERROR_TEXT||ERROR_LINE; END Alternativ...
Problem Statement: Customers would like to select evenly spaced historical data from InfoPlus.21 using SQLplus. How can this be accomplished?
Solution: Within SQLplus, there is a pseudo table named the HISTORY table. Because the boxcar data compression algorithm is used to reduce the amount of storage needed for InfoPlus.21 history, data is not stored at regular time intervals (even if it is being scanned at regular intervals). The HISTORY table can present ...
Problem Statement: How can I read comma-delimited files using SQLplus?
Solution: By selecting from a file and using the substring function to split the columns. For example: SELECT substring (1 of line between ',') as name, substring (2 of line between ',') as value FROM 'comma.txt' Keywords: References: None
Problem Statement: How does SQLPlus read values from InfoPlus.21 (IP.21) history? Are there any differences between 6.0.1 and 2004.2? Scenario #1: When the IP_#_OF_TREND_VALUES = 1, does SQLPlus grab the 1st most recent value from memory and the second one from disk? Scenario #2: When the IP_#_OF_TREND_VALUES = 5, ...
Solution: Generally speaking, in all the scenarios listed above, SQLplus simply calls an IP.21 api function when reading history. Depending on the version and the query, SQLplus will call the native IP.21 history routine, RHIS21DATA(), or some of the Setcim history routines (FINDHISX, RHISDATAX, FINDHISUSTS, RHIDATAUST...
Problem Statement: How do I determine database size information using an Aspen SQLplus query?
Solution: The function DATABASE_SIZE returns useful sizing information about an Aspen InfoPlus.21 database. The following table lists the parameters DATABASE_SIZE accepts: Parameter Description TOTAL_WORDS Total number of words MAX_WORDS Maximum number of words HEADER_WORDS Number of words in the database header LOCA...
Problem Statement: Aspen SQLPlus에서 스크립트를 실행할때 아래와 같은 오류 발생
Solution: 본 오류는 로컬 변수를 표명할때 산술계산의 데이터 종류를 지정하지 않았기 때문입니다. 만약 로컬 변수를 표명할때 데이터 종류를 지정하지 않으면 디폴트로 Variant 로컬 변수로 인식합니다. SQL 스크립트에서 변수를 표명할때 아래와 같이 데이터 종류를 지정할수 있습니다. LOCAL variable_name <data_type> Keywords: variant arithmetic failed variant KR- References: None
Problem Statement: Dividing two numbers in Aspen SQLPlus may produce unexpected results. For example: write trunc(1/3, 2); returns 0 instead of 0.33.
Solution: The result of the division depends if you are using integer or real arithmetic. If both the numerator and denominator are integer, then Aspen SQLPlus uses integer arithmetic and ignores the remainder. If either the numerator or denominator is a real number, then Aspen SQLPlus uses real arithmetic and incl...
Problem Statement: This knowledge base article discusses the precedence of security object models used by client applications and by InfoPlus.21. This article answers the question of whether or not users are able to write to the InfoPlus.21 database if: The users are granted the 'Write' privilege for SQLplus in the AFW...
Solution: The InfoPlus.21 API functions check the security level of each user before a write to InfoPlus.21 is executed. Also, when executing a write to InfoPlus.21, the SQLplus Query Writer calls the InfoPlus.21 API to communicate with the database. Therefore, a user may have SQLplus Query Writer privilege to execute ...
Problem Statement: After setting up a new database link, the queries written using that link sort timestamps alphabetically instead of chronologically. Cause This is because when configuring the Aspen SQLplus connection in the ODBC Data Source Administrator, the default setting in the SQLplus Advanced Setup automatical...
Solution: To have queries interpret timestamps as chronological events, all that is needed is to uncheck the option Timestamp sent as Character and restart Aspen SQLplus. To do this, Open the ODBC Data Source Administrator. Select the tab for System DSN Select the database link that was previously made and select Confi...
Problem Statement: This knowledge base article demonstrates how to determine the duration of time that an Aspen InfoPlus.21 tag has a certain value.
Solution: The following script will determine the duration of time that a record is at a certain value. The script takes 1 parameter, a record name. This script works with both uncompressed and compressed data and uses time arithmetic to determine the duration. NOTE: This script looks at all history for a record. It ca...
Problem Statement: Can I configure a timeout for an ODBC query?
Solution: Yes, this is one of the settings of the SQLplus/ODBC driver. You can customize it, by going to the Control Panel--> ODBC and select configure -> advanced for the SQLplus driver. Then fill in a setting for the timeout. Keywords: Desktop ODBC ODBC.21 SQLplus SQL+ References: None
Problem Statement: Meaning of '1 row inserted' and '1 row updated' in regards to updating a tag's history information using Aspen SQLplus.
Solution: When executing a Aspen SQLplus query to insert new/update old history occurrences, the user is presented one of the following messages: 1 row inserted. or 1 row updated. Although it may appear that the query executed correctly, there is still a chance that the data was not actually inserted or updated for the...
Problem Statement: How to display tagnames greater than 24 characters with an SQLPlus query?
Solution: For columns longer than the default you can use the WIDTH function. For more details on how the WIDTH function is used please read the online help for Aspen SQLplus. Example: Select Name WIDTH 64 from IP_Analogdef where name like 'atc%'; Keywords: References: None
Problem Statement: If the iqtask.exe is experiencing a memory leak there may be a problem with the queries. Specifically, if you have any queries that are cached, that is, the PROTECTED field in the fixed area of your QueryDef record is set to CACHED, and your query contains a macro, this may very well be the problem.
Solution: Unlike other SQLplus queries, which translate each statement and then execute it, a cached query will translate the whole query and store it in memory before executing it. Because a cached query has already been translated, it cannot be changed once it's been cached. This means that macros may not be re-defin...
Problem Statement: This knowledge base article demonstrates how to write a query which retrieves statistical data for a tag whenever a piece of equipment is on.
Solution: The macro EquipmentTagName contains the name of a tag defined against IP_DiscreteDef. This holds the running status (either Off or On) for a piece of equipment. The query assumes 0 means the equipment is off and 1 means the equipment is on. The macro InstrumentTagName has the name of a tag defined against IP_...
Problem Statement: How do I change the increment value of a FOR loop index?
Solution: Aspen SQLplus only increments FOR loop indexes by 1. If you need to specify a different step, then define a second variable and change the second variable within the loop as in the following example: local ndx integer; local ndx1 integer; for ndx = 1 to 5 do      if (ndx > 1) then          ...
Problem Statement: The following examples shows how to insert records into the Aspen InfoPlus.21 database using Aspen SQLplus and a delimited text file.
Solution: This example inserts 5 IP_AnalogDef records into the database. The name, description, repository, and number of repeat area occurences are set from the datafile. Example: Insert records into the InfoPlus.21 database using a delimited data file. -- The substring () function has a number of uses and is document...
Problem Statement: This Knowledge Base article shows how to calculate daily averages for an analog variable using Aspen SQLplus.
Solution: To get daily averages for an analog tag called ATCAI run this query: SELECT TS, AVG FROM AGGREGATES WHERE NAME = 'ATCAI' AND PERIOD = 24:00:00 AND TS BETWEEN '01-JAN-13' AND '01-FEB-13'; Keywords: References: None
Problem Statement: How to configure the list of printers for automated Aspen SQLplus reports?
Solution: The list of printers to be used in Automated (or scheduled) mode is based on the user account of the task server running on the Aspen InfoPlus.21 system (Aspen InfoPlus.21 Task Service). Note that Web.21 can be on a complete different machine yet the client browser can be on another one. The Automated reports...
Problem Statement: The following script will count the number of times that a valve was opened or a motor was turned on for a record. It does not matter if the data in history is compressed or uncompressed. Note: This script will search all of history the way that it is written. It can easily be modified to search a sp...
Solution: The script takes 1 variable, &1, that is the name of the record to check. You would call the script from another script as in: start record 'countit', 'test1'; >>>>> Script begins <<<<< -- -- SQLplus routine to find the number of times that something -- turned on or was opened. -- The record name is represent...
Problem Statement: Sometimes it is necessary to convert a number from INTEGER to BIT and from BIT to INTEGER. This seems like a basic and obvious function of the CAST statement. However, currently there is no direct way to do so in Aspen SQLplus. The indirect way is described below.
Solution: You can convert from integer to character and then to bit. You can convert from bit to character and then to integer. These conversions give better control about how many digits should be used. NOTE: The example shown below is based on the assumption that you have created a QueryDef record called a1query, mad...
Problem Statement: When opening the Tag Search window from SQLplus Reporting you get the warning Server: <not available> Despite the message it is still possible to search, but when trying to add the tag to the report you get the message Connect Failed. This problem occurs when using Windows authentication (as set in...
Solution: For Windows authentication to work, the AspenAppPool in IIS must run as a user with permissions to lookup users' domain group memberships. If running as LocalSystem you need to change this to an authorized domain id. You do this by opening the IIS Manager and expanding the tree structure. Select AspenAppPo...
Problem Statement: Best fit data can be queried from the Aspen InfoPlus.21 database using Aspen SQLplus by writing a query to select information from the built-in history table with a script similar to the following: select ts, value from history where name like 'atcai' and ts between '04-MAR-16 01:00:00' and '04-MAR-1...
Solution: discusses the impact of selecting a value for the “period” parameter.Solution By definition, best fit data from a given time span, or bucket, will return the first, last, largest, smallest, and first bad values within that time span. Based off the data in your database, each span can return anything between 2...
Problem Statement: How do you insert a blank line in the output of the Aspen SQLplus Web Reports (web-based reporting)?
Solution: In Aspen SQLplus Web Reports it's possible to build both interactive and automated reports section-by-section where tag data and trend plots can be displayed, among other things. If there needs to be a blank line between these sections, simply utilize a 'Title/Text' section but do not specify anything for th...
Problem Statement: Why do I get error message Disk history read error - 100 in Aspen SQLPlus. This error occurs using the Process Data Com Object and any other script executed would display the error message Disk history read error - 100
Solution: Add a new key in the registry and then add string values and value data to the new key as shown in the steps below. Note: Please Make a Backup of registry before continuing. (i) Open the Registry Editor (ii) In the registry editor go to [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{710B32A1-7277-11D1-932C-00805F0F1C...
Problem Statement: It has been noticed that the following error message can occur when trying to connect to a remote Oracle database using SQLplus: Failed to connect to link <name of link> Specified driver could not be loaded due to system error 126
Solution: This error message results from an incomplete PATH environment variable. When the Oracle client is installed, it edits the environment variable PATH, adding the value C:\ORANT\BIN. (The drive letter could be different depending on location specified during the install) This new setting should be added to both...
Problem Statement: What does the error Cannot follow chain to field mean when querying the contents of a record - usually the contents of the repeat area of that record.
Solution: The problem can usually be seen if viewing the record itself in the Aspen InfoPlus.21 Administrator Look for any fields in the fixed or repeat areas where the contents of that field are either '<<<<' signs or '>>>>' signs. You now need to find how that field is formatted. What you will probably find is that t...
Problem Statement: This
Solution: s contains instructions on how to interrogate the WMI interface from SQLplus to read a registry key. WMI - Windows Management Interface is Microsoft?s implementation of DMTF WBEM ? DMTF = Distributed Management Task Force WBEM = Web Based Enterprise ManagementSolution The following example functio...
Problem Statement: How can you use Aspen SQLplus to populate a selector record? The example below demonstrates how to populate a record, TestRec, defined by Select8Def.
Solution: Create TestRec, defined by Select8Def, using the InfoPlus.21 Administrator. In SQLplus, use this sample script to add new occurrences to the repeat area. SET EXPAND_REPEAT = 1; INSERT INTO TestRec.1 (select_description) VALUES ('val 0'); INSERT INTO TestRec.1 (select_description) VALUES ('val 1'); INSERT INTO...
Problem Statement: How to display times independent of Daylight Savings Time (DST) adjustments?
Solution: The following query illustrates how to display time-stamps disregarding the DST adjustments by using the function 'local_iso8601' in Aspen SQLPlus. Local Hrs_i INT, Mins_i INT, Offset_i INT, Sign_c CHAR, CST_Adjustment INT; write current_timestamp; write 'iso: ' || local_iso8601(current_timestamp); -- Det...
Problem Statement: You may receive the error atConnections.GetServerList: Can't create ADODB.Recordset! when you go to View > Applications log in the Tag Browser. or You may open the Tag browser and see the servers list is empty as well as being unable to enter data into the name/description fields.
Solution: This is caused when the MSADO15.DLL becomes unregistered. This can happen when installing or upgrading Aspentech or Third Party software. To resolve this error you will need to register the MSADO15.DLL file. Go to 'START' button then click 'RUN' In the open window type in regsvr32 C:\Program Files\Common File...
Problem Statement: The ODBC Data Source Administrator will usually have an entry beneath the System DSN tab for the 'AspenTech SQLplus' driver if one chooses 'SQLplus ODBC' during product installation. How can the AspenTech SQLplus Driver entry be restored so that it appears in the ODBC Data Source Administrator?
Solution: On an Operating System 32-bits AspenTech SQLplus ODBC driver 32-bits Register the ip21odbc.dll which is located in \Windows\System32. Information about using regsvr32 to register a .dll may be found here: http://support.microsoft.com/kb/249873 On an Operating System 64-bits TheSolution 120486 Problem with a...
Problem Statement: What causes the message Failed to view automated report: Access to the path 'C:\Inetpub\wwwroot\AspenTech\SQLplus\temp\ip21_servername\report_name.mht' is denied?
Solution: The AspenTech SQLplus report writer sends automated reports to the folder C:\Documents and Settings\All Users\Application Data\AspenTech\SQLplus\output. When someone uses the AspenTech SQLplus report writer to display an automated report, the report writer copies the report from C:\Documents and Settings\All ...
Problem Statement: Is it possible, when creating the connection string for the AspenTech.SQLPlus.DataProvider, to specify the data source name instead of the Host name? You can do this in the DSN less connection string for the ODBC driver, but there seems to be no option to do this for the AspenTech.SQLPlus.DataProvide...
Solution: The AspenTech.SQLPlus.DataProvider doesn't support data source name in the connection string. However, you can work around this by using an additional assembly AspenTech.ADSA.Locator as shown in the sample codes below. Add reference to both the AspenTech.ADSA.Locator and AspenTech.SQLplus.DataProvider assembl...
Problem Statement: This Knowledge Base article shows how to include a company logo in an Aspen SQLplus web report e-mail.
Solution: Below are the steps to add an image to an SQLplus web report: 1. Start Internet Explorer. 2. Type the url: http://localhost/sqlplus 3. Select the Title/Text section type. 4. Type a section name. 5. Click Add. 6. Type some text as needed. 7. Select an image. The image ...
Problem Statement: Typically production batches last less than a day. However sometimes they are longer. It may not be convenient to test a batch configuration by waiting until enough production data accumulates into the history system over time.
Solution: The following script manually inserts history into IP.21 from which a batch configuration could then be tested by running the BCU over the inserted data. To use this script you need to: Make sure that the IP21 historian has filesets old enough to accept your generated data. You would need to check that the ta...
Problem Statement: Inconsistent aggregates results as shown in the screen shot attached below are returned by SQLplus with respect to the number of decimal places displayed for F10.5 Source Tags when executing a SELECT / FROM aggregates Query. QUESTION: How can I control the displayed decimal digits for the data output...
Solution: The USING keyword command can be used after an expression in the SELECT statement list to specify an InfoPlus.21 format record for controlling the number of decimal digits that is displayed for the query output results. The specified InfoPlus.21 format record is used to format all values in the column on whic...
Problem Statement: The TRIM function appears to not work when converting a 4-digit year to a 2-digit year Running this query: local styear char(5); styear = Trim(leading 20 from 2001); write styear; styear = Trim(leading 20 from 2002); write styear; styear = Trim(leading 20 from 2003); write styear; Gives this res...
Solution: Text will be added to the SqlPlus help file in v4.1 Service Pack 1: If trim_chars contains more than one character, TRIM removes any of the specified characters in what ever order they appear. e.g.: TRIM(LEADING '20' FROM '2002203') = '3' Work Around: The substring function is better suited to changing a 4-...
Problem Statement: I have an Aspen SQLplus query/procedure that I use to validate the data entry that gets assigned into Aspen InfoPlus.21 for Analog and Discrete tags, and I also want to include a query in my procedure to validate whether providing a specified selector or format record for IP_VALUE_FORMAT is valid bas...
Solution: -- Steps to retrieve IP_AnalogDef value selections for IP_VALUE_FORMAT -- NOTE: IP_AnalogDef uses the field record named DISPLAY_WHOLE_DIGITS as its SEARCH_KEY_RECORD, and this is what controls the default selections available for IP_VALUE_FORMAT in the Aspen InfoPlus.21 Administrator for IP_AnalogDef tags: ...
Problem Statement: How do you select averages from the aggregates pseudo-table ignoring trend values that are beyond a threshold limit?
Solution: The Aspen SQLplus aggregates pseudo-table does not allow you to filter trends before selecting averages. TheSolution is to first define an Aspen Calc shared ad-hoc calculation in the Aspen InfoPlus.21 database to perform the filtering you need. For example, suppose you want to calculate averages for ATCAI aft...
Problem Statement: From
Solution: 103115, you can create a second instance of TSK_SQL_SERVER task and configure it to generate a read only connection.. In order for Automated Aspen SQLplus Web Report Tool to work properly you cannot connect to an ADSA Datasource where the port number for the Aspen SQLplus Service Component service is the one ...
Problem Statement: How can I update the Pending Number of Points for a selected Repository using Aspen SQLplus?
Solution: Included File Attachments: Set Pending Number of Points.SQL You can use the attached SQL script noted above to update the Pending Number of Points for a selected Repository via the Aspen SQLplus Query Writer. IMPORTANT: In order to be able to use the AtIP21HistAdmin COM Objects, then on the machine used t...
Problem Statement: The following error message is returned when executing a query: SYSTEM commands, CREATEOBJECT and file writes disabled at line ###. For example:
Solution: 1 This error is a result of the implementation of Aspen SQLPlus security, and the user executing the query not having permission granted for the System Command object. The query contains a SET OUTPUT command which is a permission of the System Command object. System Command allows users with this privilege to...
Problem Statement: How do I catch errors on Remote Connections in an Aspen SQLPlus query?
Solution: Catch a remote connection error with a BEGIN-EXCEPTION-END block, the remote query must be started as a sub-query. BEGIN START Record'OracleQuery'; EXCEPTION ERROR ERROR_CODE,ERROR_TEXT; END Keywords: Failed to connect to link MYLINK [MicroSoft][ODBC SQL Server driver][TCP/IP Socket] Specified...
Problem Statement: The error Unknown function: Function_Name at line x is received in Aspen SQL Plus
Solution: This problem may be due to a missing registry entry on the Aspen InfoPlus.21 server that you are running the query against. 1. From the Windows Start menu choose Run. 2. Type regedit and select OK. 3. Under the path HKEY_LOCAL_MACHINE\SOFTWARE\AspenTech\InfoPlus.21\SQLplus there should be a regi...
Problem Statement: How can I schedule an Aspen SQLplus query record to run periodically?
Solution: 1. Create a query record in the IP.21 Administrator. o For this example, the record name will be daily_report. o Use querydef for the definition record. o Set the external_task_record field to TSK_IQ1 o Make the record USABLE. 2. Start the SQLplus Query Writer client tool. o ...
Problem Statement: Is there a way to format large numbers with commas? For example, can you display 1,000,000 instead of 1000000?
Solution: Formatting large numbers with commas is possible using the function comma_format: function comma_format(num string) local newstr string; local decstr string; local minusstr string; local x string; local ndx int; -- -- Check if string is an integer or a floating point number. -- Save the decimal portion if...
Problem Statement: Is it possible to use a VIEW to read a text file and perform a SELECT on specific tags?
Solution: This article provides a sample SQLplus query. This query allows the user to perform a SELECT statement (using AGGREGATES) on a list of specific tags. The list of tags in this example is stored as a text file. First, the text file must be created. A file containing the following tag names from the demo databas...
Problem Statement: Aspen Cim-IO transfer records are not updating at the setting in IO_Frequency. Manual or scheduled polling of data works as expected, but when enabling S&F, only ONE initial datapoint comes in.
Solution: Most of the time this is a configuration issue. Here is a list of configuration items to verify. In this case, synchronous data transfer works fine (manual polling and initialization uses the synchronous main task), which means that we need to check and correct the settings for Asynchronous communication: TSK...
Problem Statement: Timestamps stored in the InfoPlus.21 database have microsecond precision. However, standard SQLplus queries have the re
Solution: at TS20 (10th of a second). How can a database timestamp value with the microsecond precision be returned on querying the database? Solution The way to display a database timestamp value with the microsecond precision is to cast the string as character format. For example (for tag name = atcai): select cast(i...
Problem Statement: Sometimes, when receiving text files to be read into IP.21 or Setcim via SQLplus, there are errors in the data. These errors will cause the INSERT INTO, UPDATE, or whatever statement you happen to be using to fail. For example, if you''re reading in numeric values from a text file and your file has U...
Solution: There is a way to basically skip past those bad entries and a null would be returned instead of an error. This allows the entire file to be read without errors. Use a Set command of CONVERT_ERRORS to accomplish this. CONVERT_ERRORS is a toggle of 0 and 1 where 1 is the default and will show the errors. To tur...
Problem Statement: A common need in reporting is to determine statistics on a certain tag while a condition on another tag is true (i.e. a valve is open, etc.). This can be done with JOINs in SQLPlus.
Solution: For example, to get the average value of tag F101 for all times when V101 = 1, the following query would work: select avg (F1VALUE) from (SELECT NAME,TS,VALUE AS V1VALUE FROM HISTORY WHERE (NAME ='V101') AND (PERIOD = '0:00:15') AND (STEPPED='1') AND TS between '1-JUN-04 10:00:00' and '3-JUN-04 10:00:00' JOIN...
Problem Statement: After an upgrade of Microsoft SQL Server or the application of a Microsoft patch the following error could occur and prevent connection to Aspen SQLPlus: SQLplus - Qualifiers: Failed to connect to link SQLSERVER [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: No...
Solution: In the event of an occurrence as described above, the following steps should be evaluated one at a time in resolving the connectivity issue. 1. Check to see if the TSK_SQL_SERVER is present and running in Aspen InfoPlus.21 Manager. If not present, manually recreate the task as shown in the figure below: a. Op...
Problem Statement: Getting error Failed to open SETCIMLINKS at line 1 when running the following query for an IP_AnalogDef tag: INSERT INTO bob.test (ip_trend_value, ip_trend_time, ip_trend_qstatus) VALUES (98.6, ''28-JAN-02 09:30:00'', ''GOOD'');
Solution: If the name of the tag contains a dot, you must use double quotes around it. For example: INSERT INTO bob.test (ip_trend_value, ip_trend_time, ip_trend_qstatus) VALUES (98.6, ''28-JAN-02 09:30:00'', ''GOOD''); Keywords: setcimlinks setcim link setcim links insert update history References: None
Problem Statement: Attempting to save a query to a custom external task is not possible because I cannot visualize my new task in the list.
Solution: Aspen SQLPlus external tasks must follow the naming convention TSK_IQx such as TSK_IQ1, TSK_IQ2, etc. You have to manually type in the external task name in case yours do not follow this rule. Keywords: TSK_IQ1 External Tasks References: None
Problem Statement: Some tags are periodically reset by sticking a new value of '0' into the tag history, even though it does not reflect the value of the measurement that the tag represents at that time. When the range of the tag is calculated for a certain time span, the range will include that '0' measurement and rep...
Solution: To work around the issue where the range function does not correctly calculate the true range of values in the tag, a query can be used to work around this issue. The query will first calculate the maximum value in the range before calculating the minimum non-zero value in the range and subtracting the two va...
Problem Statement: Indirection used on a remote IP.21 database (in our example the link is ip21) gives the error invalid RECORD value: test at line 1. Using indirection, exactly the same locally on that IP.21, works fine. Why? Example query - this works: SELECT name,definition,name->ip_plant_area FROM all_records AS b ...
Solution: SQLplus indirection is always on the local InfoPlus.21 system, it is never passed to a remote server (database link). So, the example SQLplus statement is reading the record name from a remote server but then using record indirection on the local server. If the same record doesn''t exist on the local server, ...
Problem Statement: How do I display values formatted by selector records as integers?
Solution: Use the statement cast(value as integer) as shown in the following example: write cast(testtag.IP_INPUT_VALUE as integer) Keywords: OFF/ON Discrete Query cast selector References: None
Problem Statement: Sometimes it may be necessary to know what day of the year it is on a particular day. However there is no direct command in SQLplus which would allow you to obtain an integer representing the day of the year (similar to DAY_OF_WEEK command).
Solution: This SQLplus query syntax calculates an integer representing the day of the year. This is accomplished by subtracting the start of the year from the start of the current day. write (cast('00:00' as timestamp format 'HH:MI') - cast('1-1' as timestamp format 'MM-DD'))/24:00+1 NOTE for users running AMS v6.x and...
Problem Statement: This knowledge base article describes how to determine when an Aspen SQLplus iqtask.exe (TSK_IQ#) process is hung.
Solution: If one suspects an IQ external task is frozen, go to the Aspen InfoPlus.21 Administrator | Definition Records | ExternalTaskDef and look at the specific TSK_IQ#. Right click on it and go to Properties. Check the External Task Tab and see if there is a query currently processing in the queue for a lengthy amou...
Problem Statement: How do you insert data into IP21 that includes both CDT and CST timestamps?
Solution: The following example query reads data from a text file converts the CDT and CST time stamps to an ISO8601 format then inserts the data into IP21. ProcedureDef records must be created for each of the functions listed below. (month_number, utc_offset, format_iso) Example below includes: Query (ISO_Insert), Fun...
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: How can one delete unwanted informational messages from the query result? For example, someone wrote a query to insert data into four temporary tables. Each time when data is being inserted, the result window in the Query Writer says ## rows inserted, and this message will repeat four times since the...
Solution: One can use the SET command to get rid of the informational messages from the result. By default, the SET LOG_ROWS is set to 1 which means you will see these messages. If you don''t want to see these messages, then you will need to change it to 0. For example, SET LOG_ROWS 0; will delete ALL informational mes...
Problem Statement: After upgrading to version 3.0 and above of the Aspen Manufacturing Suite, some customers have reported that the IQ command can not be run simply by typing the command name at a command prompt. To execute IQ, it is necessary to first change to the directory containing the executable.
Solution: Include the %SETCIMCODE% directory (<Drive Letter>:\Progra~1\AspenTech\InfoPlus.21\db21\code) in the Path system environment variable on the system. On Windows NT: Right click on the My Computer icon on the desktop and select Properties. Then select the Environment tab. Under System Variables, double click on...
Problem Statement: In an Aspen SQLplus script, variables are declared to hold TIMESTAMP values. However when the declared variables are used within a SELECT query, the following error message is received. Sometimes, you will get No rows selected message. However when the actual value is substituted into the query, resu...
Solution: This is caused by the way the variables are being declared. LOCAL tstart, tend TIMESTAMP; The above variables, tstart and tend, need to be declared individually. Even though the above would seem to be declaring both the variables, in actual fact, the variable tstart is not being declared with a data type at a...
Problem Statement: How do you add large groups of records to folders using SQLPlus?
Solution: There are two methods in which you could employ. Assumption: You have already created the records you would like to put into folders as well as the folders you wish to put them into. METHOD ONE: The first is straightforward and allows quick adding of records to folders. Assuming you have a folder created, ca...
Problem Statement: Sample Query that returns Engineering Unit name, its Occurence Value and its Selection Value.
Solution: The following query can be used to list all Engineering Units by name along with their Occurrence Number and Selection Value: select distinct ip_eng_units from ip_discretedef; select * from eng-units; select occnum as Occurrence number, occnum-1 as Selection Value, select_description as Engineering Unit Nam...
Problem Statement: In Aspen SQLplus, the EXECUTE command allows for the execution of a general statement on a link such as: EXECUTE statement ON link_name; It is also possible to use a variable for the link_name in the execute statement so that one can loop through a list of servers.
Solution: The example query below would allow one to accomplish the above objective. Function getlink(dummy int) local fromlink char(16); For (select line aline from 'C:\Program Files\AspenTech\InfoPlus.21\db21\sql\links.dat' where substring(4 of line between ',') = 'MyServerName') DO return substring(4 of aline betwee...
Problem Statement: How do I build a list of tags where the 'enable tag replication' choice has been checked?
Solution: The function GETREPLIC(RECID) displays the replication status of record.A The following query lists the name and replication status for all records defined by Ip_AnalogDef: SELECT NAME, GETREPLIC(RECID) FROM IP_AnalogDef GETREPLIC(RECID) returns 0 if replication for a point is not enabled and 1 if replication...
Problem Statement: While configuring a new ODBC connection using Aspen SQLplus driver, the next message is displayed:
Solution: Windows error 193 means the application is not a valid Win32 application. This means that current driver used is not the proper driver for application bit architecture. This can be caused either having the wrong driver file in System32 or SysWOW64 or by having driver path pointing to the wrong driver. For e...
Problem Statement: How do you convert an Aspen InfoPlus.21 timestamp to ISO8601 or LOCAL_ISO8601 format?
Solution: LOCAL_IS08601 timestamps are in the format of yyyy-mm-ddThh:mi:ss.ssssss+/-hh:mi where “+/-“ represents “+” or “-“ and hh:mi after “+/-“ represents an offset from UTC. In this case, yyyy-mm-ddThh:mi:ss.s represents local time. The letter T is required as well as the UTC offset +/-hh:mi. ISO8601 timestamps ...
Problem Statement: Which operator is better to use when pulling a text tag containing the operator''s name into the LastOperatorName variable? If you want to evaluate a text tag with SQLPlus, and you want to pull a text tag containing the operator''s name into the LastOperatorName variable which is char(24). Should you...
Solution: try using the TRIM statement looking something like: When TRIM(LastOperatorName) = ''Randy Judd'' then LastOperatorNum = 1231; The TRIM function removes characters from the start or end or both of a character string. For more detail about the TRIM statement, check the online help file in SQLPlus. Keywords: t...
Problem Statement: The following entry comes from the Stored procedures in ODBC topic in the SQLplus help files. However, the help file does not include a specific example. Stored procedures are useful in ODBC. The ODBC standard only allows for execution of a single SQLplus statement at a time. Stored procedures allow ...
Solution: The following is a Visual Basic example that calls a stored procedure with a parameter. Dim adoCon As New ADODB.Connection Dim adoRefer As New ADODB.Command Dim adoRecords As ADODB.Recordset adoCon.Open (SQLplus on yelm) adoRefer.ActiveConnection = adoCon adoRefer.CommandText = refer adoRefer.CommandType = a...
Problem Statement: A query run using Aspen SQLplus selecting data from a MIcrosoft SQL Server database via an ODBC link returns null values from a column with varchar(max) data type even though the same query returns (correct) non-null values when executed using the SQL Server Management Studio.
Solution: Changing the problem column's data type to varchar(256) results in the non-null values coming across into Aspen SQLplus. The problem will also be seen if you are using the Microsoft SQL Server Native Client ODBC driver. If you switch to the Microsoft SQL Server ODBC Driver instead, columns with varchar(max)...
Problem Statement: Using Aspen SQLplus, how can you determine which record and field activated a query?
Solution: In Aspen SQLplus, there are two functions which store information about the 'activator record&field': ACTIVATION_RECORD and ACTIVATION_FIELD. The following is the syntax to be used in order to get the ACTIVATION_RECORD and ACTIVATION_FIELD of a QueryDef record. For example consider I have a QueryDef record na...
Problem Statement: When running a query in the X-Windows SQLplus Interface and querying large amounts of data, the Memory Full error message will be encountered. What can be done to resolve this?
Solution: There are a number of things that can be tried to remedy this situation. The first suggestion is to limit the query more by adding additional where conditions. By shortening a time range, for instance, to narrow down the amount of data being obtained. If changing the query is not an option, another suggestion...
Problem Statement: How can one use Aspen SQLplus to access a record's references? Is there a way to get the references like what one does by right-clicking a record in the Aspen InfoPlus.21 Administrator and choosing 'Show
Solution: This is an example of using the NXTREFER function to display references to IP_AnalogDef and all tags associated with IP_AnalogDef. --This feature is available in SQLplus using the NXTREFER function. --For example, the following returns all the references to IP_AnalogDef: local search_for record, found_fie...
Problem Statement: Using Aspen SQLplus, an attempt to read the lines from a unicode or multibyte format file will fail with the following standard syntax:
Solution: Use this modified syntax when reading lines from files that are not plain text files: Keywords: chaos characters garbage extended ANSII ASCII failure for select line system write References: None
Problem Statement: What is the SECONDS field in the Aspen SQLPlus AGGREGATES pseudo table? SECONDS is not documented in Aspen SQLPlus on-line help.
Solution: SECONDS is the number of seconds since January 1, 1970, for the aggregates time stamp. Keywords: SECONDS AGGREGATES References: None
Problem Statement: How do you subtract timestamps in query?
Solution: Use the function DELTA_TIME as illustrated in the following example: local t1 timestamp, t2 timestamp; local t3 integer; t2=(select ip_trend_time from atcai where occnum=1); t1=(select ip_trend_time from atcai where occnum=20); t3=delta_time(t2, t1); update duration set ip_input_value=t3; The result of this ...