Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/How to check the length of 2 contract lists in DAML Triggers?Forum ↗

How to check the length of 2 contract lists in DAML Triggers?

App Development5 posts155 viewsLast activity Feb 2023
PR
Pris17OP
Feb 2023

I have fetched 2 contract lists by T.queryContractKey in DAML Trigger and applied some filters on it. Now I want to compare the size or length of the contract list.

How can I do that?

GA
Gary_Verhaegen
Feb 2023

Is the length function what you’re after? Otherwise, can you please share a little bit more of your code, to make your question a bit clearer?

PR
Pris17
Feb 2023

can you share a sample code for length function to compare 2 lists?

CO
cocreature
Feb 2023

Here is an example:

test = script do
  let xs = [1,2]
  let ys = [1,2,3]

  assert (length xs < length ys)
PR
Pris17
Feb 2023

Thanks @cocreature

← Back to Discussions