2

First: I'm using UC4 - dialog version 9.00A Build 234-162.

I'm trying to read a variable number of input fields (via :READ) and want to store their values into an array:

:DEFINE &FILE#, string, 10
:PUBLISH &FILE#[], , "WORKFLOW"

:BEGINREAD "Files"
:  READ &CNT#, , "Number of files", "3"
:ENDREAD

:SET &IDX# = 1
:BEGINREAD "Files"
:  WHILE &IDX# LE &CNT#
:    SET &IDX# = ADD(&IDX#, 1)
:    READ &FILE#[&IDX#], ,"???"
:  ENDWHILE
:ENDREAD

Problem is: Now I'm getting the error message U0020310 telling me the first parameter of :READ has to be a variable.

The Question: What am I missing? Is it impossible to use :READ with arrays? If thats the case: How can I work around that?

Gambrinus
  • 2,140
  • 16
  • 26
Daniel Heinrich
  • 790
  • 4
  • 12

1 Answers1

0

&CNT# has to be a Variable object (a VARA object). So you would read everything into a static VARA object.

This could than be looped through with a PREP_PROCESS command.

Gambrinus
  • 2,140
  • 16
  • 26
  • I'm not sure how this VARA object will help me create a formular with a dynamic number of Input lines. That's what the WHILE-loop in the BEGINREAD-block is for. So ... would you be willing to give me an example? As I see it, UC4 doesn't like the fact that it doesn't know the EXACT storage location for each READ-command at the beginning of the BEGINREAD-block? because :READ &FILE#[1], , "???" works like a charm - but it's not what I want... – Daniel Heinrich Sep 15 '16 at 07:06
  • Please describe exactly what you want to achieve, probably there is a simpler way of doing so. – Gambrinus Sep 15 '16 at 13:01
  • Yes, you're right, that "dynamics" in any way - like dynamic files to process and dynamic numbers of iterations does not work at runtime. – Gambrinus Oct 25 '16 at 08:23
  • what you need to do is to have a job before that one, that delivers the files and the names of the files to process could be stored in a vara-static object to hand them over to you're job that you already have. so your begin-read can use the names of files from the vara object – Gambrinus Oct 25 '16 at 08:25