# How to get a list of contract Ids from within a choice (not script)

**URL:** <https://forum.canton.network/t/how-to-get-a-list-of-contract-ids-from-within-a-choice-not-script/4130>\
**Category:** App Development\
**Tags:** daml, contract\
**Created:** [March 16, 2022, 3:07pm UTC](https://forum.canton.network/t/how-to-get-a-list-of-contract-ids-from-within-a-choice-not-script/4130 "2022-03-16T15:07:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cohen.avraham](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@cohen.avraham](https://forum.canton.network/u/cohen.avraham)\
**Post date:** [March 16, 2022, 3:07pm UTC](https://forum.canton.network/t/how-to-get-a-list-of-contract-ids-from-within-a-choice-not-script/4130/1 "2022-03-16T15:07:58Z")

</div>

G-d willing

Hello,  
I have an issuer that has a list of offers he received from his customers. On every offer, the issuer is an observer.  
I would like to have a choice where the issuer accepts or rejects all the available offers he has. But I don’t know how to fetch the list of the relevant contracts in a single command.

template A  
with  
issuer: Party  
where  
signatory issuer

```
choice DoBulk: ()
controller issuer
  do
    -- get all the contracts of type B that the issuer is an observer

```

template B  
with  
customer: Party  
issuer: Party  
where  
signatory customer  
observer issuer

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [March 17, 2022, 10:33am UTC](https://forum.canton.network/t/how-to-get-a-list-of-contract-ids-from-within-a-choice-not-script/4130/2 "2022-03-17T10:33:38Z")

</div>

You cannot “query” the ledger from within Daml. So you have basically two options here:

- Keep track of things: require that every time an offer is created, it is added to a list in a ListOfOffers contract or similar.
- Query from the client side, and provide the list of offers to accept or reject as an argument to the choice.
