Giter VIP home page Giter VIP logo

Comments (7)

opatrascoiu avatar opatrascoiu commented on July 21, 2024 1

@mankoni You can raise a DMN issue and propose the functions here https://issues.omg.org/issues/create-new-issue

The issue will be addressed by the DMN RTF force.

from tck.

baldimir avatar baldimir commented on July 21, 2024

Hi, there are no set functions like you mention, however there is e.g. list contains function which you can use in combination with a for loop to construct such custom function(s). Or you can call an external Java function. You can find all list functions in the "10.3.4.4 List functions" section of the specification (https://www.omg.org/spec/DMN/1.3/PDF).

from tck.

mankoni avatar mankoni commented on July 21, 2024

Hi baldimir
Thx for the quick response. I was able to achieve this with a for loop as you stated - looping through both lists. I faced 2 issues with this approach:

  1. When I find a match, I could not use "remove" list function as this requires a "match" to get the offset; Even then , once removed the offset of remaining elements change.
  2. the IF then ELSE syntax requires ELSE as mandatory so I had to replace elements that matched with a unique value (say 9999999). I then sorted the resulting array where I get 999999 at the end of the list. These elements need to be removed. Since they are at the end of the list, I counted the # of 999999 and used the sublist function to truncate the list (as opposed to remove function that requires offsets)

This is a workaround but I am not happy with this approach. In the absence of a cleaner approach I will go with this for now.

EXAMPLE: List 1[1,2,3,5,6] ; List 2[3,5]
List1 - List2 = [1,2,6]

Steps:
Find List1 , List2 matching elements and replace with 999999(or some high value) and sort. Output>> [1,2,6,99999,99999]
Count the # of 999999 using for loop using context variable. Output>>2
Use sublist to truncate List 1. sublist(List1,1,count(List1)-2). Output>>[1,2,6]

from tck.

mankoni avatar mankoni commented on July 21, 2024

@opatrascoiu , Will do. Thx

from tck.

baldimir avatar baldimir commented on July 21, 2024

@mankoni I played with this a bit and found out you can do something like that with filtering:

list[some filter], e.g. list1[list contains(list2, item)]

from tck.

brsilver avatar brsilver commented on July 21, 2024

from tck.

mankoni avatar mankoni commented on July 21, 2024

Thanks to Bruce and Baldimir. Excellent solutions for my need. I will close this issue

from tck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.