Reading a CSV file for comparing data

If you have a new question you’d like our support staff to post a response to, please visit our customer community, Data Security Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
2 posts Page 1 of 1


Posts: 41
Joined: Wed Mar 30, 2011 10:19 am

Post by monahanks » Thu Mar 16, 2017 10:27 am
Hi all, I have a project that involves reading a CSV file and comparing a column from the file to a data variable.
I am retrieving the name of the day of the week (Mon, Thu, etc) using the set variable function into variable TodayIs. I have a CSV file that has 7 rows corresponding to the days of the week. To mix things up a little, Sat is day 1, Sun is day 2, up through Fri is day 7.
I read the csv file and create a rowset named ReturnDay.
Then I want a for-each-loop to read the rowset and compare the first column to the TodayIs variable and return the second column if equal. the error I get says they are different types of variables.
how do I define these to be both character variables? My xml is below.
Code: Select all
<project name="Get Promotions files" mainModule="Main" version="2.0" logLevel="debug">
	<description>retrieve promotion files from crm7promo</description>
	<import file="D:\GoAnywhere\userdata\projects\VARIABLES\VAR_Common_AS400.xml" />
	<variable name="TodayIs" value="xxx" description="3 letter Name of Day" />
	<variable name="daynum" value="6" description="Day of week number  Saturday = 1, Sunday = 2, Friday = 7 " />

	<module name="Main" logLevel="debug">

		<createWorkspace label="Create Workspace" version="1.0" />

		<callModule label="Call Module" module="VarAS400" version="1.0" />

		<setVariable name="TodayIs" value="${CurrentDate(&apos;E&apos;)}" version="2.0" />

		<readCSV inputFile="D:\GoAnywhere\userdata\Aptos\Daynumber.csv" outputRowSetVariable="ReturnDay" version="1.0">
			<data trim="both">
				<column index="1" name="dayname" size="3" type="VARCHAR" trim="right" />
				<column index="2" name="daynumber" size="1" type="INTEGER" />

		<forEachLoop itemsVariable="${ReturnDay}" currentItemVariable="row">

			<print version="1.0" disabled="false">
				<![CDATA[Return Day = ${ReturnDay}

row = ${row}]]>

			<if label="compare day name" condition="${dayname eq TodayIs}" disabled="true">

				<setVariable label="set day number" name="daynumb" value="${daynumber}" version="2.0" />

			<exitLoop condition="${5 eq 1}" />

		<deleteWorkspace label="Delete Workspace" version="1.0" disabled="true" />




Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Mar 20, 2017 11:41 am

Try putting a "String()" around each variable .. so, you end up comparing apples to apples.

${ string( dayname ) eq string( TodayIs ) }
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1