Page 1 of 1
Can a column in a rowset be changed?
Posted: Wed Jan 04, 2012 4:31 pm
by rutledge_tx76
Vendor wants a name's suffix to be one character. i.e. JR or JR. becomes J, I is 1, II is 2 etc. I thought of creating a table to do the conversion but because of file sizes (over 600,000 records) it is not very practical. So I looked at the set variable task to see if it would but can't see how do it. Can anybody help.
Re: Can a column in a rowset be changed?
Posted: Tue Feb 14, 2012 2:39 pm
by Support_Duane
The only way for GoAnywhere Director to change one (or more) columns in a rowset, would be to process the file one row at a time. This would not be a speedy process.
Re: Can a column in a rowset be changed?
Posted: Tue Feb 28, 2012 11:27 am
by RElliott63
If you are retrieving your dataset from a database (ie, DB2, MSSQL, etc) and are using an SQL Function to retrieve that data, you can do the following:
Code: Select all<setVariable label="Set sqlError" name="sqlError" value="0" version="1.0" />
<sql label="Connect to Server" resourceId="${ Server }" version="1.0" onError="setVariable:sqlError=1">
<query label="Get Doc Recs" outputVariable="DocRecs" whenNoDataFound="error">
<statement>
Select FirstName, LastName,
Case When upper( Suffix ) like 'JR%' Then 'J'
When upper( Suffix ) like 'I' Then '1'
When upper( Suffix ) like 'II' Then '2'
When upper( Suffix ) like 'SR%' Then 'S'
Else ' '
End as Suffix,
Address1, Address2, City, State, Zip, Phone
From MyLib.MyFile
Where MyField = 'MyValue'
</statement>
</query>
</sql>
This assumes that the Suffix is a separate field value.
-Rick