Centura Gupta Team Developer Automation Possibility - sqlbase

Is there a automation tool which can automate the software build on Team Developer (v6.0).
I have tried with multiple automation tools to spy the table object in the application, it identifies it as Gupta ChildTable. But I am not able to retrieve the values from the row.
For example:
1. I have 10 rows in the table(grid) with 12 columns. I need to find the value "AAAAA" contained in first column and select that particular row via Automation.
2. I have 10 rows in the table(grid) with 12 columns. I need to find the value "AAAAA" contained in first column and click on particular cell in that row to input the data via Automation.
Thanks in advance.

Use VisTblFindString . This function ( and many others ) are included into your TD code if include 'VT.apl' in your include libraries .
VisTblFindString will return the Row - so then you simply set context to that row using SalTblSetContext( hWndForm, nRow ) , and then you can refer to the contents of each cell by name to return the value.
Syntax
nRow = VisTblFindString(hWndTable, nStartRow, hWndColumn, sString)
Handle: hWndTable
Number: nStartRow
Number: hWndColumn
String: sString
Description
Locates a string value within a column.
The string must match exactly, but case is ignored. Searching ends when the last row in the table is checked. A SAM_FetchRow message is sent for all rows that have not yet been fetched into the cache.
You can use the pattern matching characters understood by the function SalStrScan. The percent character (%) matches any set of characters. The underscore character ( _ ) matches any single character.
Parameters
hWndTable Table window handle.
nStartRow Row number at which to start the search.
hWndColumn Handle of column to search. Use hWndNULL to search all string columns.
sString String for which to search.
Return Value
Number: The row number if sString is found, or -1 if not found.
Example:
Set nRow = VisTblFindString (twOrders, 0, colDesc, 'AAAAAA')
Call SalTblSetContext( twOrders , nRow )
( Now you can get the value of any cell in nRow by referring to the Column Name )
e.g. Set sCellValue = twOrders.colDesc or Set sCellValue = twOrders.colId etc.

Rows ( or anything what-so-ever in a TableWindow - even the cell borders , backgrounds , lines, row headers etc ) can be treat as an 'Item' or 'Object' by TeamDeveloper . Recommend you use MTbl - it is an invaluable set of add-on functions that make dealing with Tables a breeze. I know of no sites using TableWindows that don't use MTbl. In terms of rows , you can define any row as an Item or Object and manipulate it accordingly. See M!Tbl ( a TableWindows extention ) and specifically fcMTblItem.DefineAsRow( hWndTbl, nRow ).
BTW , you can also use MTbl to completely change the look and feel of your TableWindows , to give them a real modern look.

Very rough napkin code, don't have TD on this computer. Not that you can copy&paste this easily anyway due to the code structure, only line by line.
tbl1 is the name of the table, col1 is the name of the column, substitute to fit your program.
Set nRow = TBL_MinRow
While SalTblFindNextRow( tbl1, nRow, 0, 0 )
Call SalTblSetContext( tbl1, nRow )
If tbl1.col1 = "AAAAA"
Call SalTblSetFocusCell( tbl1, nRow, tbl1.col1, 0, -1 )
Break
This should run through each row, check whether col1 has the chosen value, and then activates edit mode for that cell - provided the column is editable.

Related

How To Take Left Side String From A Particular position using PostgreSql

I have a table in that table there is a column called eq1.sources in that column, entries are like mentioned below. Now I would like to extract the string from the left side to till card slot number only.
Example:
fdn:realm:pam:network:55.150.40.841:shelf-1:cardSlot-1:card:daughterCardSlot-1:daughterCard
for this entry I need only
fdn:realm:pam:network:55.150.40.841:shelf-1:cardSlot-1
similarly
fdn:realm:sam:network:35.250.40.834:shelf-1:cardSlot-1:card
for this entry I need
fdn:realm:sam:network:35.250.40.834:shelf-1:cardSlot-1
I have tried substring(eq1.sources,0,position (':card:daughter' in eq1.sources)). this is working only for row numbers 1,2,4,5,6,7,9,10 but row number 3,8,11 not working as the entries not continued with ':card:daughter'.
The column name for the below entries is eq1.sources.
1.fdn:realm:pam:network:55.150.40.841:shelf-1:cardSlot-1:card:daughterCardSlot-1:daughterCard
2.fdn:realm:pam:network:35.250.40.824:shelf-1:cardSlot-1:card:daughterCardSlot-1:daughterCard
3.fdn:realm:sam:network:35.250.40.834:shelf-1:cardSlot-1:card
4.fdn:realm:pam:network:55.159.40.994:shelf-1:cardSlot-2:card:daughterCardSlot-1:daughterCard
5.fdn:realm:pam:network:35.250.140.104:shelf-1:cardSlot-2:card:daughterCardSlot-1:daughterCard
6.fdn:realm:pam:network:55.170.40.1:shelf-1:cardSlot-2:card:daughterCardSlot-1:daughterCard
7.fdn:realm:pam:network:35.450.40.24:shelf-1:cardSlot-3:card:daughterCardSlot-1:daughterCard
8.fdn:realm:sam:network:35.250.40.14:shelf-1:cardSlot-3:card
9.fdn:realm:pam:network:55.150.40.854:shelf-1:cardSlot-4:card:daughterCardSlot-1:daughterCard
10.fdn:realm:pam:network:35.250.40.84:shelf-1:cardSlot-5:card:daughterCardSlot-1:daughterCard
11.fdn:realm:sam:network:35.250.40.84:shelf-1:cardSlot-6:card
Expecting a PostgreSQL query to extract left side substring from a particular position in a row.
Expected output is
1.fdn:realm:sam:network:35.250.40.834:shelf-1:cardSlot-1
2.fdn:realm:sam:network:35.250.40.14:shelf-1:cardSlot-3:card
from
1.fdn:realm:sam:network:35.250.40.834:shelf-1:cardSlot-1:card:daughterCardSlot-1:daughterCard
2.fdn:realm:sam:network:35.250.40.14:shelf-1:cardSlot-3:card
First split the string into an array with : as a delimiter (this is the t subquery) and then pick the first 7 array elements and join them again into a string with : delimiter.
select array_to_string(arr[1:7], ':') as sources
from
(
select string_to_array(sources, ':') as arr
from the_table
) as t;
See demo.

Using Postgresql, count consecutive numbers in a table, which has length of more than 5

Telephone_number
111111111
1111143452
000000000
888888888
5554038291
1111392012
9999999999
2324666666
So from the above, I want to have only those records that have the same digit repeated more than 5 times.
The output count should be 5.
You can a regular expression with a repeated back reference.
with test (telephone_number) as
( values ('111111111')
, ('1111143452')
, ('000000000')
, ('888888888')
, ('5554038291')
, ('1111392012')
, ('9999999999')
, ('2324666666')
)
select telephone_number
from test
where telephone_number ~ '(\d)\1{5,}';
This does depend on how the columns are defined, as numeric or as text. If numeric definition then you need to play around in converting to text for using a regular expression. See fiddle.

Check if character varying is between range of numbers

I hava data in my database and i need to select all data where 1 column number is between 1-100.
Im having problems, because i cant use - between 1 and 100; Because that column is character varying, not integer. But all data are numbers (i cant change it to integer).
Code;
dst_db1.eachRow("Select length_to_fault from diags where length_to_fault between 1 AND 100")
Error - operator does not exist: character varying >= integer
Since your column supposed to contain numeric values but is defined as text (or version of text) there will be times when it does not i.e. You need 2 validations: that the column actually contains numeric data and that it falls into your value restriction. So add the following predicates to your query.
and length_to_fault ~ '^\+?\d+(\.\d*)?$'
and length_to_fault::numeric <# ('[1.0,100.0]')::numrange;
The first builds a regexp that insures the column is a valid floating point value. The second insures the numeric value fall within the specified numeric range. See fiddle.
I understand you cannot change the database, but this looks like a good place for a check constraint esp. if n/a is the only non-numeric are allowed. You may want to talk with your DBA ans see about the following constraint.
alter table diags
add constraint length_to_fault_check
check ( lower(length_to_fault) = 'n/a'
or ( length_to_fault ~ '^\+?\d+(\.\d*)?$'
and length_to_fault::numeric <# ('[1.0,100.0]')::numrange
)
);
Then your query need only check that:
lower(lenth_to_fault) != 'n/a'
The below PostgreSQL query will work
SELECT length_to_fault FROM diags WHERE regexp_replace(length_to_fault, '[\s+]', '', 'g')::numeric BETWEEN 1 AND 100;

TSQL split comma delimited string

I am trying to create a stored procedure that will split 3 text boxes on a webpage that have user input that all have comma delimited strings in it. We have a field called 'combined_name' in our table that we have to search for first and last name and any known errors or nicknames etc. such as #p1: 'grei,grie' #p2: 'joh,jon,j..' p3: is empty.
The reason for the third box is after I get the basics set up we will have does not contain, starts with, ends with and IS to narrow our results further.
So I am looking to get all records that CONTAINS any combination of those. I originally wrote this in LINQ but it didn't work as you cannot query a list and a dataset. The dataset is too large (1.3 million records) to be put into a list so I have to use a stored procedure which is likely better anyway.
Will I have to use 2 SP, one to split each field and one for the select query or can this be done with one? What function do I use for contains in tsql? I tried using IN win a query but cannot figure out how it works with multiple parameters.
Please note that this will be an internal site that has limited access so worrying about sql injection is not a priority.
I did attempt dynamic SQL but am not getting the correct results back:
CREATE PROCEDURE uspJudgments #fullName nvarchar(100) AS
EXEC('SELECT *
FROM new_judgment_system.dbo.defendants_ALL
WHERE combined_name IN (' + #fullName + ')')
GO
EXEC uspJudgments #fullName = '''grein'', ''grien'''
Even if this did retrieve the correct results how would this be done with 3 parameters?
You may try use this to split string and obtain a tables of strings. Then to have all the combinations you may use full join of these two tables. And then do your select.
Here is the Table valued function I set up:
ALTER FUNCTION [dbo].[Split] (#sep char(1), #s varchar(8000))
RETURNS table
AS
RETURN (
WITH splitter_cte AS (
SELECT CHARINDEX(#sep, #s) as pos, 0 as lastPos
UNION ALL
SELECT CHARINDEX(#sep, #s, pos + 1), pos
FROM splitter_cte
WHERE pos > 0
)
SELECT SUBSTRING(#s, lastPos + 1,
case when pos = 0 then 80000
else pos - lastPos -1 end) as OutputValues
FROM splitter_cte
)
)

select first letter of different columns in oracle

I want a query which will return a combination of characters and number
Example:
Table name - emp
Columns required - fname,lname,code
If fname=abc and lname=pqr and the row is very first of the table then result should be code = ap001.
For next row it should be like this:
Fname = efg, lname = rst
Code = er002 and likewise.
I know that we can use substr to retrieve first letter of a colume but I don't know how to use it to do with two columns and how to concatenate.
OK. You know you can use substr function. Now, to concatenate you will need a concatenation operator ||. To get the number of row retrieved by your query, you need the rownum pseudocolumn. Perhaps you will also need to use to_char function to format the number. About all those functions and operators you can read in SQL reference. Anyway I think you need something like this (I didn't check it):
select substr(fname, 1, 1) || substr(lname, 1, 1) || to_char(rownum, 'fm009') code
from emp