Posted Sat, 05 Jun 2021 01:48:18 GMT by

Good Day.

This is my scenario, and I hope someone can help.

I have a dataset, that I have added a column to it. The Dataset has originally 6 columns, in is being bumped up eg:7

Is there a way to set a variable with a dataset column with a variable name?? eg: capture = %dsReportStructure.Columncountervariable%, rather than having to access the dataset by eg: dataset.Column1, dataset.Column2, etc.

The number of columns in the dataset will to increase by 1, each time the task is executed.

Loop i=1,i<=total,i++

    capture = %capture + dsReportStructure.Column(i)%

Posted Wed, 09 Jun 2021 06:17:55 GMT by

Kristy,

 

Please copy and paste this into task builder:

 

<AMVARIABLE NAME="varCounter" VALUE="" />
<AMVARIABLE NAME="varCell" VALUE="" />
<AMDATASET RESULTDATASET="ds" COLUMNS="Column1,Column2,Column3" DELIMITER="comma" />
<AMDATASET ACTIVITY="insert_row" DATASET="ds" ROWLOCATION="end"><COLUMNSETTER COLUMNNAME="Column1" VALUE="A1" /><COLUMNSETTER COLUMNNAME="Column2" VALUE="B1" /><COLUMNSETTER COLUMNNAME="Column3" VALUE="C1" /></AMDATASET>
<AMDATASET ACTIVITY="insert_row" DATASET="ds" ROWLOCATION="end"><COLUMNSETTER COLUMNNAME="Column1" VALUE="A2" /><COLUMNSETTER COLUMNNAME="Column2" VALUE="B2" /><COLUMNSETTER COLUMNNAME="Column3" VALUE="C2" /></AMDATASET>
<AMDATASET ACTIVITY="insert_row" DATASET="ds" ROWLOCATION="end"><COLUMNSETTER COLUMNNAME="Column1" VALUE="A3" /><COLUMNSETTER COLUMNNAME="Column2" VALUE="B3" /><COLUMNSETTER COLUMNNAME="Column3" VALUE="C3" /></AMDATASET>
<AMLOOP ACTIVITY="dataset" DATASET="ds" />
<AMLOOP FROM="1" TO="3" RESULTVARIABLE="varCounter" />
<AMVARIABLE ACTIVITY="set" VARIABLENAME="varCell">ds.Column%varCounter%</AMVARIABLE>
<AMSHOWDIALOG>%GetVarValueByVarName(varCell)%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />
<AMLOOP ACTIVITY="end" />

Thanks, Chris

You must be signed in to post in this forum.