Do you know where I could get the below details in the OPALS OutSystems OSSYS tables? (If that is possible)
This is SQL Server syntax;
SELECT TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = "blah" AND TABLE_NAME = "moo"
I have the below query and I need to dynamically return the Row Count for each of the Entities (i.e. tables) . It doesn't like the highlighted method at the end of the SQL script
WITH B AS ( select e.name espace_name, oe.name entity_name, oea.name attribute_name, coalesce('Foreign key to ' + k.type_name + ' ' + k.data_kind, oea.type) Type, oea.length, oea.decimals, oea.is_mandatory, oea.is_autonumber, CASE WHEN oep.primarykey_ss_key IS NOT Null THEN 'Yes' END as Is_Primary_Key, oe.description entity_description, oea.order_num from ossys_application a inner join ossys_app_definition_module d on a.id = d.application_id inner join ossys_module m on d.module_id = m.id inner join ossys_espace e on m.espace_id = e.id inner join ossys_entity oe on oe.espace_id = e.id inner join ossys_entity_attr oea on oea.entity_id = oe.id left JOIN ossys_entity oep on oep.primarykey_ss_key = oea.ss_key left join ( select 'bt' + ke.ss_key + '*' + koe.ss_key type_ss_key , koe.name type_name , koe.data_kind from ossys_espace ke inner join ossys_entity koe on koe.espace_id = ke.id where ke.is_active = 1 and koe.is_active = 1 ) k on k.type_ss_key = oea.type where --a.name like 'ARR%' --and --oe.name = 'POLICY' e.name IN ( 'Adviser_CS', 'AdviserData_CS', 'Party_CS', 'PolicyAdministration_CS', 'PolicyEvent_CS', 'PolicyFinance_CS', 'Product_CS', 'ReferenceData_CS', 'Report_CS') and oe.is_active = 1 and oea.is_active = 1 and e.is_active = 1 and a.is_active = 1 ),
C AS ( SELECT espace_name, entity_name, attribute_name, Type, length, decimals, CASE WHEN Type LIKE 'Foreign%' THEN 'True' ELSE 'False' END AS 'is_Foreign_key' , is_mandatory, is_autonumber, entity_description, order_num FROM b ),
CC AS ( SELECT * FROM c WHERE espace_name = 'PolicyFinance_CS' -- ORDER BY entity_name ) ,
D AS ( SELECT entity_name, COUNT(entity_name) AS COUNT_entity_name FROM cc GROUP BY entity_name )
SELECT B.espace_name as Schema_Table, B.entity_name as Table_Name, B.attribute_name as Column_Name, B.Type, B.length, B.decimals, CASE WHEN B.IS_MANDATORY = 'True' THEN 'Y' ELSE 'N' END AS NOT_NULL_YN, Is_Primary_Key, (Select Count(*) From B.entity_name)
FROM B
WHERE B.ESPACE_NAME = 'PolicyADMINISTRATION_CS'
ORDER BY B.ESPACE_NAME, B.ENTITY_NAME, B.ORDER_NUM;
Hi,
If you are on premises installation, then you can access the DB like your query above, but if it on cloud, I don't think you can, specially on OSSYS_ tables
Thanks