Forum Discussion

mpartyka's avatar
mpartyka
Contributor
7 years ago

groovy syntax help

Looking for help with groovy syntax ... 

 

Based on the data that I read from grid in data source loop ... I need to test the data in  specific column #.  The grid specifies the column # that should be tested & I grab that # here >>

 

                          def referenceColumn = context.expand( '${DataSource-filename#referenceColumn}' )

 

                          result can be 1, 2 or 3

 

I also have 3 ids that I have read from a nested data source loop 

 

                          def referenceId1 = context.expand( '${DataSource-ResourceId#1}' )
                          def referenceId2 = context.expand( '${DataSource-ResourceId#2}' )

                          def referenceId3 = context.expand( '${DataSource-ResourceId#3}' )

 

 

 

I only want to grab and test the referenceId that equals the referenceColumn ... so if referenceColumn = 2, then I want to grab referenceId2.  

 

Not sure how to create the syntax to replace the "2" with the referenceColumn from the data source step?  

 

                          context.expand( '${DataSource-ResourceId#2}' )

 

Thanks!

  • context.expand( "\${DataSource-ResourceId#$referenceColumn}" )

  • PaulMS's avatar
    PaulMS
    Super Contributor

    context.expand( "\${DataSource-ResourceId#$referenceColumn}" )