[Swift-user] Could not convert value to number: true

Mihael Hategan hategan at mcs.anl.gov
Mon Jun 25 22:09:19 CDT 2007


Mappers don't populate data structures with values. They can indicate
the files where data can be found.

Try this:
----------------
type student {
    string name;
    int    age;
    float  GPA;
}

type messagefile {}

(messagefile t) sayAge(string file) {
    app {
        echo "Age: " file stdout=@filename(t);
    }
}

student p[]<csv_mapper;file="student.txt">;

messagefile outfile <"age.txt">;

string f = @filename(p[0].name);

outfile=sayAge(f);
------------------

And you'll get:
bash-3.1$ cat age.txt
Age:  Aaaa

As for doing what you want, I have to think about it.

Mihael

On Mon, 2007-06-25 at 21:53 -0500, Luciano Piccoli wrote:
> Hi,
> 
> I am getting the following error when running the swift script below:
> 
>     bash-3.00$ swift -dryrun age.swift -tc.file tc.data
>     Swift V 0.0405
>     RunID: phvopumbeee40
>     Execution failed:
>             org.globus.cog.karajan.workflow.KarajanRuntimeException: 
> Could not convert value to number: true
> 
> Is the multiplication an invalid operation in this case?
> Thanks,
> Luciano
> 
> ---- age.swift ----
> type student { 
>     string name; 
>     int    age; 
>     float  GPA;
> } 
> 
> type messagefile {}
> 
> (messagefile t) sayAge(int age) {
>     app {
>         echo "Age: " @age stdout=@filename(t);
>     }
> }
> 
> student p[]<csv_mapper;file="student.txt">;
> 
> messagefile outfile <"age.txt">;
> 
> int age = p[0].age * 4;
> 
> outfile = sayAge(age);
> ------------------
> 
> ---- student.txt ---
> name age GPA
> Aaaa 23 3.1415
> Bbbb 12 2.7212
> Cccc 25 4.456
> -------------------
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-user
> 




More information about the Swift-user mailing list