0

I have two different lists and i want to iterate both the list at the same time.

<table class="form">
    <thead>
    <tr>
        <th>Name</th>
        <th>Status</th>
    </tr>
    </thead>
    <tbody>
    <#list names as list>
        <tr>
            <td>${list.name}</td>
            <td><#list status as list1>${list1}</#list></td>
        </tr>
    </#list>
    </tbody>
</table>

Expected result output like this: enter image description here

but actual output is looking like this: enter image description here

Is this a correct way to iterate list and list1?


If you are using a provided template, in the documentation you can review the configuration parameters. Seems like the foramt of the outputStagingTableNameTemplate parameter that you are trying to use is not properly configured. Can you check that the format is correct?

gcloud beta dataflow flex-template run JOB_NAME \
    --project=PROJECT_ID \
    --region=REGION_NAME \
    --enable-streaming-engine \
    --template-file-gcs-location=gs://dataflow-templates/VERSION/flex/Cloud_Datastream_to_BigQuery \
    --parameters \
inputFilePattern=GCS_FILE_PATH,\
gcsPubSubSubscription=GCS_SUBSCRIPTION_NAME,\
outputStagingDatasetTemplate=BIGQUERY_DATASET,\
outputDatasetTemplate=BIGQUERY_DATASET,\
outputStagingTableNameTemplate=[project_id]:[dataset_id].[table_id],\
outputTableNameTemplate=BIGQUERY_TABLE_log

For example, if the target table were a table from a public google datasets (which is not possible, it is just an example) the outputStagingTableNameTemplate parameter should be like this:

outputStagingTableNameTemplate=bigquery-public-data:covid19_italy.data_by_province

Where:

  • bigquery-public-data is the project_id
  • covid19_italy is the dataset_id
  • data_by_province is the table_id
4

1 回答 1

0

编辑

根据评论,您有 2 个列表,因此使用第一个列表索引从第二个列表中获取相关值

<#list names as list>
     <tr>
        <td>${list.name}</td>
        <td>${status[list?index]}</td>
    </tr>
</#list>

如果你有一个列表,你应该只有一个#list,因为你应该只迭代一次:

<#list names as list>
     <tr>
        <td>${list.name}</td>
        <td>${list.status}</td>
    </tr>
</#list>

正如@ddekany 所写,考虑更改变量名

于 2022-01-18T17:44:12.697 回答