Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Get-PropertiesFromTable #13

Open
cnEUL opened this issue Jun 20, 2023 · 0 comments
Open

Add Get-PropertiesFromTable #13

cnEUL opened this issue Jun 20, 2023 · 0 comments
Labels
function request Any idea for a new function or a function enhancement

Comments

@cnEUL
Copy link
Contributor

cnEUL commented Jun 20, 2023

Something like this:
Function Get-PropertiesFromTable [
params(
[string]$tableName = 'Article'
[string]$breadcrumb
[int]PropertyId
)

Here you can select all objects, i.e. records, that are available in TableName at the node. All subfolders are recursively traversed until all property containers are found and the IDs of the objects are collected. Duplicates are filtered.

;WITH Tree(ID) AS
(
SELECT ID
FROM Merkmal
WHERE ID = 1002 -- Starting point of the tree
AND Tabelle = 'Artikel'
AND MerkmalTyp <> 2
UNION ALL
SELECT m.ID
FROM Merkmal m
INNER JOIN Tree t ON m.ParentID = t.ID
WHERE m.Tabelle = 'Artikel'
AND m.MerkmalTyp <> 2
)
SELECT DISTINCT me.ObjektId [Id]
FROM MerkmalElement me
INNER JOIN Tree t ON me.KopfId = t.ID;

@cnEUL cnEUL added the function request Any idea for a new function or a function enhancement label Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
function request Any idea for a new function or a function enhancement
Projects
None yet
Development

No branches or pull requests

1 participant