Title: Multi-dimensional array initialization syntax? Post by: Hans-Joachim K. on November 09, 2023, 12:30:08 pm Hello, this is probably an easy one for you but I did not find any hint in the doc so far.
When defining a simple array, I can initialize it at the same time: DEFINE myarray1 ARRAY [4] OF INTEGER = [ 1, 2, 3, 4 ] But when defining a two-dimensional array like this: DEFINE myarray2 ARRAY [2,4] OF INTEGER How is the syntax then? I tried different variants but was not successful so far. Thank you very much in advance, Hajo Title: Re: Multi-dimensional array initialization syntax? Post by: Sebastien F. on November 09, 2023, 02:09:56 pm Hi!
Code
Title: Re: Multi-dimensional array initialization syntax? Post by: Hans-Joachim K. on November 09, 2023, 03:05:59 pm Hello Sebastien, thank you for your fast reply.
This way of initialization was actually among the ones I tried, but I am always getting this: Compiling 'jobs/testArr.4gl' testArr.4gl:4:1:4:1:error:(-6609) A grammatical error has been found at '[' expecting: CHAR_CONST INT_CONST DEC_CONST IDENT DATETIME FALSE INTERVAL MDY NOTFOUND NULL TRUE '+' '-' '(' '%'. ::error:(GS-1072) The command 'fglcomp --build-rdd -M /opt/gstshare/watmes_khj/jobs/testArr.4gl' failed with exit code 1. *** Failure [15:01:28] *** I am using exactly your code: IMPORT util DEFINE arr ARRAY[5,3] OF INTEGER = [ [1,2,3], [1,2,3], [1,2,3], [1,2,3], [1,2,3] ] MAIN DISPLAY util.JSON.stringify(arr) END MAIN Was there maybe a bugfix which I am missing in the compiler? I am using Studio 4.00.03 with the matching version on the Linux host. Thank you very much, Hajo Title: Re: Multi-dimensional array initialization syntax? Post by: Sebastien F. on November 09, 2023, 03:26:29 pm Consider watching the product news on our web site!
https://4js.com/news/products/ Genero 4.00 is desupported since 4.01 was released back in April 2022: https://4js.com/2022-genero-enterprise-4-01-maintenance-release/ The latest version of Genero BDL is 4.01.05: https://4js.com/2023-genero-enterprise-four-js-maintenance-release-activity-for-september-2023/ Download from: https://4js.com/download/products/? Seb Title: Re: Multi-dimensional array initialization syntax? Post by: Rene S. on November 09, 2023, 03:49:59 pm ... requires 4.01.02 or later.
|