user6624: I am currently testing a plutus script on cardano-cli, I need to use 2 inputs from a SC address that have different datum, how can I specify both  --tx-in-datum-file for the transaction?
Thanks

user5085: You can just define multiple by reusing the same flag multiple times like so:
cardano-cli transaction build \
  --tx-in 123#0
  --tx-in-script-file SCRIPT_FILE1
  --tx-in-datum-file JSON_DATUM_FILE1
  --tx-in 456#0
  --tx-in-script-file SCRIPT_FILE2
  --tx-in-datum-file JSON_DATUM_FILE2
  {...}

You can see from the cardano-cli documentation notation that you can declare multiple tx-ins, datums and redeemers:
(--tx-in TX-IN
   [--tx-in-script-file FILE
      [
        ( --tx-in-datum-cbor-file CBOR FILE
           | --tx-in-datum-file JSON FILE
           | --tx-in-datum-value JSON VALUE
        )
        ( --tx-in-redeemer-cbor-file CBOR FILE
           | --tx-in-redeemer-file JSON FILE
           | --tx-in-redeemer-value JSON VALUE
        )
      ]
   ]
)

Inside your validator (onchain) code you can use findDatum to retrieve the respective datum by its hash or pattern matching.

6624: <p>I am currently testing a plutus script on cardano-cli, I need to use 2 inputs from a SC address that have different datum, how can I specify both <code> --tx-in-datum-file</code> for the transaction?</p>
<p>Thanks</p>
 5085: <p>You can just define multiple by reusing the same flag multiple times like so:</p>
<pre><code>cardano-cli transaction build \
  --tx-in 123#0
  --tx-in-script-file SCRIPT_FILE1
  --tx-in-datum-file JSON_DATUM_FILE1
  --tx-in 456#0
  --tx-in-script-file SCRIPT_FILE2
  --tx-in-datum-file JSON_DATUM_FILE2
  {...}
</code></pre>
<p>You can see from the cardano-cli documentation notation that you can declare multiple tx-ins, datums and redeemers:</p>
<pre><code>(--tx-in TX-IN
   [--tx-in-script-file FILE
      [
        ( --tx-in-datum-cbor-file CBOR FILE
           | --tx-in-datum-file JSON FILE
           | --tx-in-datum-value JSON VALUE
        )
        ( --tx-in-redeemer-cbor-file CBOR FILE
           | --tx-in-redeemer-file JSON FILE
           | --tx-in-redeemer-value JSON VALUE
        )
      ]
   ]
)
</code></pre>
<p>Inside your validator (onchain) code you can use <code>findDatum</code> to retrieve the respective datum by its hash or pattern matching.</p>
