title: Reusing PCollection from output of a Transform in another Transform which is later stage of pipeline
body: <p>In java or any other Programming we can save state of a variable and refer the variable value later as needed. This seems to be not possible with Apache beam, can someone confirm? If it is possible please point me to some samples or documentation.</p>
  
  <p>I am trying to solve below which needs context of my previous transform output.</p>
  
  <p>I am new to Apache Beam so finding it hard to understand how to solve the above. </p>
  
  <p>Approach#1:</p>
  
  <pre class="lang-java prettyprint-override"><code>PCollection config = p.apply(ReadDBConfigFn(options.getPath()));
  PCollection&lt;Record&gt; records = config.apply(FetchRecordsFn());
  PCollection&lt;Users&gt; users = config.apply(FetchUsersFn());
  </code></pre>
  
  <p>// Now Process using both 'records' and 'users', <strong>How can this be done with beam?</strong></p>
  
  <p>Approach#2:</p>
  
  <pre class="lang-java prettyprint-override"><code>PCollection config = p.apply(ReadDBConfigFn(options.getPath()));
  PCollection&lt;Record&gt; records = config.apply(FetchRecordsFn()).apply(FetchUsersAndProcessRecordsFn());
  </code></pre>
  
  <p>// Above line 'FetchUsersAndProcessRecordsFn' needs 'config' so it can fetch Users but <strong>there is seems to be no possible way?</strong></p>