viernes, 17 de mayo de 2024

[JD Edwards] Orchestrator Manipulate Output (ENG)

Hola JDEFriends,

In this occassion, I'm going to show you how to manipulate the output json of your orchestrator. Well because we want to add or remove some element of it, group, change tags, etc. that we have not been able to do in the orchestration itself.

The first one we should to do is execute our orchestrator and see our json output. Next, we're go to output properties and on the tab "Manipulate output":


Here, we have our json as input and output. In the middle, we can to do custom manipulations in groovy, jruby, etc. script language acoording to your version and preference.

In my case, I want was to remove some json nodes based on an input parameter (in this case, in the exection of the availability application P41202).

Here the code:

availability_grid.reject! do |item|

        if jsonIn['GetTotals'] != "1"
            item['Location'] == 'TOTAL:' || item['Location'] == 'GRAND TOTAL:'
        end
    end

And here, you can do everything you can image and/or need.

You will have to run your orchestrator trial and error, off course, since until now, we have no way to debug or test it individually.

Happy code!

jueves, 16 de mayo de 2024

[JD Edwards] Orchestrator Manipulate Output (ES)

Hola JDE Amigos,

En ésta ocasión, os voy a mostrar cómo manipular el json de salida de vuestro orchestrator. Bien porque querramos añadir o eliminar algún elemento del mismo, agrupar, cambiar etiquetas, etc. que no hemos podido hacer en la propia orquestación.

Lo primero que debemos hacer es ejecutar nuestro orchestrator y ver la salida de nuestro json. A continuación, nos vamos a las propiedades de salida y a la pestaña "Manipulate Output":


 Aquí tendremos como entrada y salida de la función nuestro json. En medio, podemos hacer las manipulaciones que necesitemos en lenguaje script groovy, jruby, etc. según vuestra versión y preferencia.

En mi caso, lo que quería era quitar unos nodos del json en función de un parámetro de entrada (en este caso en la ejecución de la aplicación de disponibilidad P41202).

He aquí el código:

availability_grid.reject! do |item|

        if jsonIn['GetTotals'] != "1"
            item['Location'] == 'TOTAL:' || item['Location'] == 'GRAND TOTAL:'
        end
    end

Y aquí ya podréis realizar todo lo que podáis imaginar y/o necesitéis. 

Tendréis que ejecutar a prueba-error vuestro orchestrator eso sí, ya que hasta ahora, no tenemos forma de poder debugarlo ni testearlo individualmente.

Feliz código!

[JD Edwards] P90U100 - Table Definition Inquiry (ENG)

 Hola JDEFriends,


As I mentioned in a previous post, we have the JDETables web tool to inquiry fields, index, perform queries, etc. on JDE tables.

Well, interanally in JDE we have a application with a similar functionality which is P90U100 - Table Definition Inquiry:


En esta pantalla podemos filtrar por una tabla y obtener todos sus campos con sencuencias, alias, nombre, índice, tipo de dato y todas las propiedades de cada campo del diccionario de datos.

In this query we can filter by a table and get all its fields with sequences, alias, name, index, data type, and all data dictionary properties.

Very useful, although with less functionality than JDETables obviously.

Happy code!

[JD Edwards] P90U100 - Table Definition Inquiry (ES)

 Hola JDE Amigos,


Como comenté en un post anterior, tenemos la herramienta web JDETables para consultar campos, índices, realizar queries, etc. sobre tablas de JDE.

Pues bien, internamente en JDE tenemos una aplicación con una funcionalidad similar que es P90U100 - Table Definition Iquiry:


En esta pantalla podemos filtrar por una tabla y obtener todos sus campos con sencuencias, alias, nombre, índice, tipo de dato y todas las propiedades de cada campo del diccionario de datos.

Muy útil, aunque con menos funcionalidad que JDETables obviamente.

Feliz Código!

martes, 30 de abril de 2024

[SQL] LISTAGG Function

Sometimes, I'm find needing go group data grouping by a line. For example, how get and export all user emails. Normally, we have 1-1 relation a database table, but we want export grouping un a unique line by user. I'm sure, we could export to a excel and pivot in a table, or with other tool. But, how to do it in SQL?

The solution lies in the LISTAGG function, which groups all rows results into a single colum.

The sintax is the next:

           
SELECT LISTAGG(column_name, delimiter) WITHIN GROUP (ORDER BY ordering_column)
FROM table_name

        

Consequently, in the previous example, we could achieve this with the following query:

SELECT EAAN8, ABALPH, LISTAGG(TRIM(EAEMAL), ',') WITHIN GROUP (ORDER BY EAEMAL) AS EMAILS FROM F01151 JOIN F0101 ON EAAN8=ABAN8 WHERE EAETP = 'E' GROUP BY EAAN8, ABALPH;

Return the nex ouptut:


In next posts we are looking how export in XML, JSON, etc. format.

Kind regards and good code!


[SQL] Función LISTAGG

 Hola JDEFriends,

En ocasiones me he encontrado con la necesidad de obtener datos agrupando en una línea. Por ejemplo, cómo obtener y exportar todos los emails de un usuario. Normalmente, para ello tenemos relación 1-1 en una tabla en base de datos, pero queremos exportar agrupado en una única línea por usuario. Seguramente podamos exportarlo a un excel y pivotarlo en una tabla o con otra herramienta ¿Cómo hacemos esto en SQL?

La solución está en la función LISTAGG, la cual agrupa en una única columna todos los resultados de las filas.

La sintaxis es la siguiente:

        
           
SELECT LISTAGG(column_name, delimiter) WITHIN GROUP (ORDER BY ordering_column)
FROM table_name

        

Por lo cual, en el ejemplo anterior podríamos realizarlo con la siguiente query:

SELECT EAAN8, ABALPH, LISTAGG(TRIM(EAEMAL), ',') WITHIN GROUP (ORDER BY EAEMAL) AS EMAILS FROM F01151 JOIN F0101 ON EAAN8=ABAN8 WHERE EAETP = 'E' GROUP BY EAAN8, ABALPH;

Con la siguiente salida:


En otro posts veremos cómo exportar en formato XML, JSON, etc.

Saludos y buen código!


viernes, 1 de abril de 2022

[JD Edwards - BSSV] Import external JAVA library (ENG)

Hi jde friends,

Sometimes, we find ourselves with need to extend JD Edwards functionalities and we find many functionalities in JAVA packages or libraries, JAVA is one of the most languages and platform used in technologies. For example, recently I worked in a project to implement Bidimensional code QR. So, what is the JDE solution?


Well, we use a JAVA library to facilitate the coding. In this case IdAutomation (that is license paid, but there are other as Google (Zxing) and many other open source, depending on each case and use). So, this provider provides a java library in witch it has a class and a method for facility implementation, that we pass the string to be encoded and it return as array string encoded. Later, to this array we put a font in BIPublisher and we already have our encoded QR code. Easy right?

Then, we generated our BSSV object (and we cannot forget our BSFN in C to communicate our report or application with BSSV component), with our class and main method. But, how import IdAutomation QR library to our JD Developer project?

1. On our project, we press the rigth button and in the context menu click on Project Properties:

2. Press in Librares and Classpath menu and next press button Add JAR Directory

3. Select the JAVA library (I recommend leaving in the JDE Path JDE system\Classes (later I explain the reason)

4. Press on Open button in the dialog, and it is added to the project:

5. Press OK and save the project. We can use library classes and method importing to our java class.

               boolean bestMask = true;           // Best pattern mask
               
               String resultQREncode = qre.FontEncode(dataToEncode, applyTilde, encodingMode, errorCorrectionLevel, version, bestMask);
               internalVO.setSzQREncodedData(resultQREncode);
               
               printMsg(context, "Encoded => ");
               printMsg(context, resultQREncode);

And we have everything ready in our project!!!

To deploy, we have to configure system to use a external library for when compiling and generating deploy package it imports the external library in jar jde deploy package. This configuration is done in deploy server (although I also configure it in my fat client).

1. Copy the library to system\Classes folder:

2. Modify the file sbffoundation.ini inside the same folder, in the section [Foundation] y and add a line "LIB" + "next sequence" + "=" + "library name"

And with this we already our BSSV project with an external library ready to deploy!

Pd: I have also used an external library for Datamatrix code, integrate with Webcenter Content through RIDC standard java package, and recently to create a proxy client webservice through an external library with java wsimport command to integrate with Salesforce that you can see here.

Good code JDE Friends!