Forum Discussion

dva1946's avatar
dva1946
Occasional Contributor
14 years ago

trim from sql select statement solution

I have looked everywhere for this solution, but do not see it.

Can not use "trim(at.name) as it gives an error = invalid column name
Using "oracle.jdbc.driver.OracleDriver"

sql.eachRow("select Distinct(ho.OFFERING_ID), adt.delivery_method, at.asset_type, at.name from h_offering ho, offering_delivery_type odt, asset_delivery_type adt, asset ass, asset_type at where ho.service_type = 1 and odt.offering_name = ho.offering_id and adt.delivery_type_id = odt.delivery_type_id and ass.asset_id = adt.asset_id and at.asset_type = ass.asset_type and ho.deleted_flag = 0 and ROWNUM <= ${scriptLIMIT} order by ho.offering_id, adt.delivery_method") { row ->

log.info " $row.offering_id | $row.delivery_method | $row.asset_type | $row.name |";
Tue Jan 10 10:08:58 MST 2012:INFO: 3322 | dsmcc-openstream-streaming | 2 | MovieAsset |

Need to trim $row.name so it can be easily used here:

if (offeringStatusMovie == 'MovieAsset') {
...
}

Prefer to have a clean solution, as these testsuites passed on to QA groups w/less technical skill.

Any thoughts?

Thanks,

1 Reply

  • dva1946's avatar
    dva1946
    Occasional Contributor
    May have quickly found my own solution.

    1. Save to property
    testRunner.testCase.setPropertyValue( "AssetType", "$row.name" )

    2. Retrieve property and add trim to it. Seems to work.
    def assetType = context.expand( '${#TestCase#AssetType}' ).trim()

    log.info "|$assetType|"

    Tue Jan 10 10:46:15 MST 2012:INFO:|MovieAsset|