# Is interface View a read-only dataset?

**URL:** <https://forum.canton.network/t/is-interface-view-a-read-only-dataset/5578>\
**Category:** App Development\
**Tags:** daml\
**Created:** [November 2, 2022, 7:38pm UTC](https://forum.canton.network/t/is-interface-view-a-read-only-dataset/5578 "2022-11-02T19:38:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![code\_monkey](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/code_monkey/32/4936_2.png) [@code\_monkey](https://forum.canton.network/u/code_monkey)\
**Post date:** [November 2, 2022, 7:38pm UTC](https://forum.canton.network/t/is-interface-view-a-read-only-dataset/5578/1 "2022-11-02T19:38:41Z")

</div>

What are the ethics for defining attributes of Interface View? Should the parameters being passed during contract creation be passed on to the interface view? Are they read-only, and what happens when we archive a contract? If not, how do I update a view from within a contract instance.

```haskell
module Daml.Grants.Interface.Workflow.Processes.PreAwardProcess where
-- | View for `Process`.
data View = View
  with
    state : PreAwardPhaseState  
       -- ^ Internal state of the workflow process.
    generalReviewerTask : ContractId Task.I  
       -- ^ The task assigned to the party reviewing the grant opportunity.      
    technicalReviewer : ContractId Task.I  
       -- ^ The task assigned to the party providing the technical review of the grant opportunity.      
    financialReviewer : ContractId Task.I  
       -- ^ The task assigned to the party providing the financial review of the grant opportunity.      
  deriving (Eq, Show)
...
...
...

-- | An interface to implement pre-award process
interface Process where
  viewtype V
...
...
...

-- | A representation of process object
template PreAwardProcess
  with
    processKey : ProcessKey
      -- ^ Unique identifier for the process.
    grantOpportunityCid : ContractId GrantOpportunity.I
      -- ^ An identifier of the grant opportunity.
    grantApplicationCid : ContractId GrantApplication.I
      -- ^ An identifier of the grant application.
    state : PreAwardPhaseState  
       -- ^ Internal state of the workflow process.  
    observers : PartiesMap
      -- ^ The factory's observers
  where
...
...
...

```

---

<div class="post-metadata">

**Author:** ![Matteo\_Limberto](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/matteo_limberto/32/2823_2.png) [@Matteo\_Limberto](https://forum.canton.network/u/Matteo_Limberto)\
**Post date:** [November 3, 2022, 12:08pm UTC](https://forum.canton.network/t/is-interface-view-a-read-only-dataset/5578/2 "2022-11-03T12:08:16Z")

</div>

Hi @code_monkey,

The view for an interface is derived from the implementing template’s attributes. You specify how to construct the view once you define your interface instance, e.g.,

```haskell
interface instance Process for PreAwardProcess where
  view = View with state = state; generalReviewerTask = ...

```

As far as I understand, views are never stored on the ledger, they are just calculated from the implementing template. In this regard, they are just “projections” of a contract.

Contracts in Daml are immutable, which makes the view for an interface of a specific contract also immutable. In order to change e.g. the `state` in your code above, you need to `archive` the original `PreAwardProcess` contract and `create` a new one with an updated `state`. The view for the new contract will contain the updated `state`.

Hope this helps,  
Matteo
