Skip to content
CCPEDIAby Unity Nodes
App Development

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

5 posts171 viewsLast activity Feb 2023

  1. Pris17OP

    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?

  2. Gary_Verhaegen

    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?

  3. Pris17

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

  4. cocreature

    Here is an example:

    test = script do
      let xs = [1,2]
      let ys = [1,2,3]
    
      assert (length xs < length ys)
    
  5. Pris17

    Thanks @cocreature