Toegang vanuit Power BI tot bewakingscodes in Bouw7

Ik zou graag de nog niet openbare Bouw7 API uitlezen:

/project/{projectID}/project-security-links

Hierin staan de bewakingscodes.

Voor Bouw7 wordt een dynamisch datamodel gebruikt o.b.v. swagger.json.

De huidige definitie hiervoor klopt niet:

"\/project\/project-security-link\/{id}": {
"get": {
"summary": "Returns a single project security link based on the given ID.",
"description": "Returns a single project security link based on the given ID.",
"operationId": "getProjectSecurityLink",

en leidt bij een query zoals:

select *
from projects@bow pjt
join projectsecuritylinkbyid@bow(pjt.id)

tot:

itgenbow018
B7\Database\Entity\Security\ProjectSecurityLink object not found by the @ParamConverter annotation.
The remote server returned an error: (404) Not Found.

Er zal even overleg nodig zijn of Bouw7 de aanpassing maakt in hun metadata (voorkeur) of dat er een workaround gemaakt wordt in de driver, of dat er gebruik gemaakt wordt van de workaround met een eigen query zoals:

insert into nativeplatformscalarrequests@bow(url)
select 'https://heimdall.bouw7.nl/project/' || pjt.id || '/project-security-links'
from projects@bow pjt

De nieuwe API is schijnbaar nog niet officieel gepubliceerd. We wachten bij voorkeur de nieuwe release van Bouw7 af.

De nieuwe API is te vinden op New Apollo APIs for Bouw7 (Exact Online Bouw).

De nieuwe project-security-links API is geen onderdeel van Bouw7 Apollo, maar van Heimdal.

Het ophalen via Swagger (specificatie van de Heimdal API van Bouw7) is nog niet mogelijk omdat project-security-links hier nog niet in gedocumenteerd is.

De hoofdbewakingscodes zijn te bepalen voor een project via:

select *
from   jsontable
       ( '[*].securityCodesPerChapters[*].securityCodeChapter'
         passing json
         columns id   int      path 'id'
         ,       name varchar2 path 'name'
         ,       code varchar2 path 'code'
       )

De bewakingscodes / kostensoorten zijn op te halen voor een project via:

select *
from   jsontable
       ( '[*].securityCodesPerChapters[*].budgetDataPerSecurityCodes[*]'
         passing json
         columns ChapterId               int      path '::ancestor.securityCodeChapter.id'
         ,       ChapterName             varchar2 path '::ancestor.securityCodeChapter.name'
         ,       ChapterCode             varchar2 path '::ancestor.securityCodeChapter.code'
         ,       SecurityCodeId          int      path 'securityCode.id'
         ,       SecurityCodeName        varchar2 path 'securityCode.name'
         ,       SecurityCodeCode        varchar2 path 'securityCode.code'
         ,       SecurityCodeChapterName varchar2 path 'securityCode.chapterName'
         ,       Name                    varchar2 path 'name'
         ,       LaborHours              number   path 'laborHours'
         ,       LaborHourlyRate         number   path 'laborHourlyRate'
         ,       LaborCosts              number   path 'laborCosts'
         ,       PurchaseOrderCosts      number   path 'purchaseOrderCosts'
         ,       SubcontractorCosts      number   path 'subcontractorCosts'
         ,       EquipmentHours          number   path 'equipmentHours'
         ,       EquipmentHourlyRate     number   path 'equipmentHourlyRate'
         ,       EquipmentCosts          number   path 'equipmentCosts'
         ,       MaterialCosts           number   path 'materialCosts'
         ,       WasteCosts              number   path 'wasteCosts'
         ,       MiscellaneousCosts      number   path 'miscellaneousCosts'
         ,       CreatedAt               datetime path 'createdAt'
         ,       CreatedBy               varchar2 path 'createdBy'
         ,       UpdatedAt               datetime path 'updatedAt'
         ,       UpdatedBy               varchar2 path 'updatedBy'
         -- Skipped: array nonEditableCostTypes
       )

Gecombineerd voor gebruik als Startup SQL van een Invantive Cloud-database wordt het (zie Startup SQL instelbaar voor alle Invantive Cloud-gebruikers)

declare
  l_unique_id varchar2;
begin
  l_unique_id := to_char(newid());
  insert into Bouw7.Native.NATIVEPLATFORMSCALARREQUESTS
  ( url
  , HTTP_METHOD
  , ORIG_SYSTEM_GROUP
  , ORIG_SYSTEM_REFERENCE
  , HTTP_DISK_CACHE_USE
  , HTTP_DISK_CACHE_SAVE
  , HTTP_DISK_CACHE_MAX_AGE_SEC
  )
  select 'https://heimdall.bouw7.nl/project/' || to_char(pjt.id) || '/project-security-links'
  ,      'GET'
  ,      to_char(pjt.id)
  ,      l_unique_id || '-PSK-PJT-' || to_char(pjt.id)
  ,      true
  ,      true
  ,      3600 * 20 /* 20 hours cache */
  from   projects pjt
  ;
  create or replace table ProjectSecurityCodeChapters@InMemoryStorage
  as
  select nst.ProjectId
  ,      jte.*
  from   ( select result_text, to_number(orig_system_group) ProjectId from Bouw7.Native.NATIVEPLATFORMSCALARREQUESTS where orig_system_reference like l_unique_id || '-%' ) nst
  join   jsontable
         ( '[*].securityCodesPerChapters[*].securityCodeChapter'
           passing nst.result_text
           columns id   int      path 'id'
           ,       name varchar2 path 'name'
           ,       code varchar2 path 'code'
         ) jte
  ;
  create or replace table ProjectSecurityCodeBudgetData@InMemoryStorage
  as
  select nst.ProjectId
  ,      jte.*
  from   ( select result_text, to_number(orig_system_group) ProjectId from Bouw7.Native.NATIVEPLATFORMSCALARREQUESTS where orig_system_reference like l_unique_id || '-%' ) nst
  join   jsontable
         ( '[*].securityCodesPerChapters[*].budgetDataPerSecurityCodes[*]'
           passing nst.result_text
           columns ChapterId               int      path '::ancestor.securityCodeChapter.id'
           ,       ChapterName             varchar2 path '::ancestor.securityCodeChapter.name'
           ,       ChapterCode             varchar2 path '::ancestor.securityCodeChapter.code'
           ,       SecurityCodeId          int      path 'securityCode.id'
           ,       SecurityCodeName        varchar2 path 'securityCode.name'
           ,       SecurityCodeCode        varchar2 path 'securityCode.code'
           ,       SecurityCodeChapterName varchar2 path 'securityCode.chapterName'
           ,       Name                    varchar2 path 'name'
           ,       LaborHours              number   path 'laborHours'
           ,       LaborHourlyRate         number   path 'laborHourlyRate'
           ,       LaborCosts              number   path 'laborCosts'
           ,       PurchaseOrderCosts      number   path 'purchaseOrderCosts'
           ,       SubcontractorCosts      number   path 'subcontractorCosts'
           ,       EquipmentHours          number   path 'equipmentHours'
           ,       EquipmentHourlyRate     number   path 'equipmentHourlyRate'
           ,       EquipmentCosts          number   path 'equipmentCosts'
           ,       MaterialCosts           number   path 'materialCosts'
           ,       WasteCosts              number   path 'wasteCosts'
           ,       MiscellaneousCosts      number   path 'miscellaneousCosts'
           ,       CreatedAt               datetime path 'createdAt'
           ,       CreatedBy               varchar2 path 'createdBy'
           ,       UpdatedAt               datetime path 'updatedAt'
           ,       UpdatedBy               varchar2 path 'updatedBy'
           -- Skipped: array nonEditableCostTypes
         ) jte
  ;
end;

Na het sluiten van de database en het legen van de caches op Invantive Bridge Online zullen er twee nieuwe tabellen zichtbaar worden:

  • ProjectSecurityCodeChapters@InMemoryStorage: hoofdstukken
  • ProjectSecurityCodeBudgetData@InMemoryStorage: bewakingscodes

Een verzoek is ingediend bij Bouw7 om project-security-links ook beschikbaar te krijgen in de metadatadefinities van de Bouw7 API’s.

Deze vraag is automatisch gesloten na 2 weken inactiviteit. Het laatste gegeven antwoord is gemarkeerd als oplossing.

Gelieve een nieuwe vraag te stellen via een apart topic als het probleem opnieuw optreedt. Gelieve in de nieuwe vraag een link naar dit topic op te nemen door de URL er van in de tekst te plakken.

Deze tabellen zijn helaas niet zichtbaar in het datamodel, via UniversalSQL-editor lukt het wel.

Als ik een create or replace view toevoeg, geeft de database een itgenqte009 foutmelding.

Het punt is nogmaals onder de aandacht gebracht bij Bouw7. Mocht daar feedback op komen, dan werken we het topic bij.

Het lukt Invantive niet om een zinvolle behandeling van deze vraag te verzorgen over de bewakingscodes. Advies is om dit zelf aan te kaarten bij Bouw7 en eventueel te escaleren.