Hello everyone,
I want to use the table transformer macro to execute two SQL selects depending on a condition.
If the Project row in the table shown is filled, the Select command should then execute a different select than if the row is not filled.
I have already tried the following. However, this does not work.
Thank you very much for your help!
DECLARE @projekt VARCHAR(255) = (SELECT T2.'Projekt' FROM T2);
IF (@projekt = "")
SELECT T2.'Sortiment',T2.'Produktbereich',T2.'Dokument',T2.'System',T2.'Status',T2.'Projekt' FROM T2
ELSE
SELECT T2.'Sortiment',T2.'Produktbereich',T2.'Dokument',T2.'System',T2.'Status',T2.'Projekt', CONCAT("15.",T1.'Verkaufsstart (SOD) Monat'::string->split("/")->1,".",T1.'Verkaufsstart (SOD)'::string->split("/")->0) AS 'Verkaufsstart' FROM T1,T2 WHERE T1.'Projekte' LIKE T2.'Projekt'
I would suggest you reach out to the support portal of Stiltsoft. As they are the vendor and developer of the app.
They could be able to tell you if this is an option in there app r not and they might see this a bug or a feature request.
Please refer to our support portal as @Marc - Devoteam has kindly mentioned.
The Table Transformer macro is based on the AlaSQL library and includes some limited functions of the JavaScript, so all the cases should be implemented accordingly to their rules.
To apply the condition, we can use the CASE WHEN statement from the AlaSQL library.
So, for us to help you with the SQL query, please attach the page storage of your page (upper right corner of the page -> menu ... -> View storage format). Then we'll be able to recreate exactly your page with macros, queries, and source tables.
I also see that you have the Table Excerpt Include macro inside the internal Table Transformer macro - please attach the page storage of the page with the corresponding Table Excerpt macro as well.
And from the query I can see that if the project name is empty, then you want to show the second table as it is. If it is not empty, then you want to show some extra data from the first table and you need to find this data by the project name. If I've got you wrong, please describe the desired result in the ticket as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everyone,
Nikita has helped me to understand the Macro.
I have placed an additional table transformer around the table, which now transposes the table.
With the following query it now works as desired.
DECLARE @projekt VARCHAR(255) = (SELECT T2.'Projekt' FROM T2);
IF (@projekt = "")
SELECT T2.'Sortiment',T2.'Produktbereich',T2.'Dokument',T2.'System',T2.'Status',T2.'Projekt' FROM T2
ELSE
SELECT T2.'Sortiment',T2.'Produktbereich',T2.'Dokument',T2.'System',T2.'Status',T2.'Projekt', CONCAT("15.",T1.'Verkaufsstart (SOD) Monat'::string->split("/")->1,".",T1.'Verkaufsstart (SOD)'::string->split("/")->0) AS 'Verkaufsstart' FROM T1,T2 WHERE T1.'Projekte' LIKE T2.'Projekt'
Thank you very much for your support.
Best wishes,
Marc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.