Customer Portal

Passing parameter to graph while using Clover Server

Comments 4

  • Avatar
    psimecek
    0
    Comment actions Permalink
    Hi Marc,

    Would it be possible for you not to use RunGraph component, but specify different file names using an input port of a reader component (most readers have that port)?

    See a simple graph in a sceenshot. I have connected a DataGenerator component, which generates URLs with use of this CTL expression:
    "${DATAIN_DIR}/file" + num2str(sequence(FileNbrSequence).next()) + ".txt"

    where FileNbrSequence is a custom defined sequence with both, start and step, set to 1. You can easily define your sequence is the view Outline ->Sequences -> context menu Sequences -> Create New Sequence.

    I attach a graph for illustation (it reads files file1.txt, file2.txt and file3.txt are writes them back to file.out.txt.
    I have tested it on a Clover server and it works fine for me.

    Pavel Simecek
    Javlin
  • Avatar
    mdavenport
    0
    Comment actions Permalink
    Unfortunately, this wouldn't do what I need. Your suggestion merges the output from all files.

    file_1_in.txt + file_2_in.txt > file_out.txt

    I need a distinct output foreach file.
    file_1_in.txt > file_1_out.txt
    file_2_in.txt > file_2_out.txt
  • Avatar
    psimecek
    0
    Comment actions Permalink
    Hi Marc,

    Yes, for this case some non-trivial modifications to my previous graph are needed:
    (1) metadata of a link out-going from a reader component must additionally contain a field with an input file name. For this field you must set autofilling to source_name.
    (2) Then the file number must be extracted with use of Reformat component with transforms a file path like "c:\data\file_55.txt" to a string value "55". The following CTL formula does the job:
    pop(find($0.filename, "[0-9][0-9]*"))


    (3) An incomming link to a writer component than contains data to write plus an additional field with file number. With use of partitioning you can write records to different file according to an attached file number. File partitioning can be set up this way:
    support_file_in_out_sequence.png

    I hope this will solve your problem, since I do not see any way to solve it with use of RunGraph component. We will surely make enhancements to the way of executing other graphs on a server. For now, I would use the solution I proposed here.

    The graph with a proof of the concept is attached.

    Best regards,

    Pavel Simecek
  • Avatar
    mdavenport
    0
    Comment actions Permalink
    Pavel,

    Thank you very much for you reply. I had to finish this before i left for a winter holiday. I ended up making a perl script to just write the 100 graphs that perform the tasks. I do look forward to seeing if I can do this in another programmatic way with server in the future.

    All the best,
    Marc

Please sign in to leave a comment.