Skip to content

Instantly share code, notes, and snippets.

View damithsj's full-sized avatar

Damith Jinasena damithsj

View GitHub Profile
@damithsj
damithsj / CognitiveServices.cs
Created April 16, 2024 10:20
Azure Function for Azure Speech Services Speech Text which Inputs Any Audio Format
using Azure.Core;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.CognitiveServices.Speech;
using Microsoft.CognitiveServices.Speech.Audio;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using System.Diagnostics;
@damithsj
damithsj / TestWfSendToRestAPI_version_4.bpmn
Created February 19, 2024 11:51
Send Data to a REST API using IFS Workflow
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="TestWfSendToRestAPI" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_010w4hh</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="Activity_1p3jku4" name="Send to REST API" camunda:class="com.ifsworld.fnd.bpa.delegate.IfsHttpConnectionDelegate">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="ifsBpaHttpConnectionMethod">POST</camunda:inputParameter>
@damithsj
damithsj / build.xml
Last active September 27, 2023 09:17
ifs-build-xml-add-3rd-party-jar
<target name="build" depends="compile">
<jar jarfile="${dist}/IFSTestTransformer-1.0.1.jar" basedir="${build}">
<fileset dir="${lib}" includes="your-external-lib.jar" />
<manifest>
<attribute name="Transformer-class" value="TestTransformer"/>
</manifest>
</jar>
</target>
@damithsj
damithsj / ifs_cloud_send_email_with_doc_attachments_and_media_items.sql
Created April 10, 2023 08:57
Event action based on PDF_REPORT_CREATED event for Work Order report. Email is sent with Work Order report with documents and media items attached to work order
-- Author : Damith Jinasena (damithsj@gmail.com)
-- Purpose : Event action based on PDF_REPORT_CREATED event for Work Order report.
-- Email is sent with Work Order report with documents and media items attached to work order
-- App Version : Apps10, IFS Cloud 2X RX
declare
wo_nos_ VARCHAR2(100) := LTRIM('&NOTES', 'WO No List: ');
wo_no_ VARCHAR2(100);
keyref_ VARCHAR2(2000);
file_name_ VARCHAR2(2000);
attachments_ COMMAND_SYS.ATTACHMENT_ARR;
@damithsj
damithsj / ifs_cloud_create_csv_and attach_to_email.sql
Last active April 10, 2023 08:58
Event action based on PDF_REPORT_CREATED event for Purchase Order report. Email is sent with purchase order report as well as a CSV containing line information
-- Author : Damith Jinasena (damithsj@gmail.com)
-- Purpose : Event action based on PDF_REPORT_CREATED event for Purchase Order report.
-- Email is sent with purchase order report as well as a CSV containing line information
-- App Version : Apps10, IFS Cloud 2X RX
declare
po_no_ VARCHAR2(100):= '&PDF_PARAMETER_6';
attachments_ COMMAND_SYS.ATTACHMENT_ARR;
csv_header_ VARCHAR2(32000);
csv_line_ VARCHAR2(32000);
@damithsj
damithsj / ifs_mail_attachment_csv_app10.sql
Created February 28, 2023 10:34
Send IFS Mail with a CLOB attachment
declare
attachments_ COMMAND_SYS.ATTACHMENT_ARR;
attachment_ CLOB;
begin
-- Create CSV as a CLOB
attachment_ := 'ADD YOUR CSV CONTENT HERE';
--Add the CSV as an attachment
COMMAND_SYS.Add_Attachment(attachments_ => attachments_,
filename_ => 'your_filename.csv',
@damithsj
damithsj / create_and_print_report_schedule.sql
Last active April 23, 2023 15:10
Create and print IFS report via schedule job
DECLARE
result_key_ NUMBER;
report_attr_ VARCHAR2(32000);
parameter_attr_ VARCHAR2(32000);
message_attr_ VARCHAR2(2000);
archiving_attr_ VARCHAR2(2000);
distribution_list_ VARCHAR2(32000);
print_attr_ VARCHAR2(32000);
next_execution_date_ DATE;
schedule_name_ VARCHAR2(200);
@damithsj
damithsj / create_and_print_report.sql
Created January 30, 2023 20:30
Simple Create and Print Report IFS Commands
DECLARE
report_id_ VARCHAR2(100) := 'SHOP_ORD_WI_REP'; -- Report ID
report_attr_ VARCHAR2(2000);
parameter_attr_ VARCHAR2(2000);
distribution_list_ VARCHAR2(2000):= '';
result_key_ NUMBER;
printer_id_ VARCHAR2(100);
@damithsj
damithsj / IFS_DATAService.dbs
Created June 1, 2017 18:21
WSO2EI DataSource for IFS Database
<data name="IFSAPP9PROD" serviceNamespace="IFS" transports="http https local">
<description>IFS App9 Production</description>
<config enableOData="false" id="IFSAPP9PROD">
<property name="driverClassName">oracle.jdbc.driver.OracleDriver</property>
<property name="url">jdbc:oracle:thin:@<DBHOST>:1521:<SID></property>
<property name="username"><APPOWNER></property>
<property name="password"><APPOWNER_PW></property>
</config>
<query id="SELECT_ALL_WO_QUERY" useConfig="IFSAPP9PROD">
<sql>select CONTRACT, ORG_CODE, MCH_CODE, MCH_CODE_DESCRIPTION, MCH_CODE_CONTRACT, WO_NO, REG_DATE, ERR_DESCR, PLAN_S_DATE, REPORTED_BY, PART_NO, STATE from ACTIVE_SEPARATE</sql>
@damithsj
damithsj / linspaceCpp
Created August 27, 2014 12:07
C++ implementation of linspace function in MatLab. This function generates N points between min and max and return as vector.
#include <cmath>
#include <vector>
using namespace std;
//linspace function in MatLab. hacked the code ;)
// ...\toolbox\matlab\elmat\linspace.m
//generates N points between min and max and return as vector.
vector<double> linspace(double min, double max, int n)
{