Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: 2 dimension array  (Read 12815 times)
Wee Ting C.
Posts: 23


« on: November 08, 2017, 08:25:52 am »

Hi,

I'm using "vi" to create 4GL and form. In the BDL documentation, it only mention how to write coding for 2 dimension array.

May I know how to create the per for 2 dimension array?

Any assistance is appreciated.

Thank you.

Regards,
Cheong
Reuben B.
Four Js
Posts: 1049


« Reply #1 on: November 08, 2017, 09:49:11 am »

Hi Cheong,

Can you please provide more detail for your question.  Your question could be interpreted a few different ways.

Are you a beginning who is coding your first array, so you have a DYNAMIC ARRAY datatype, a DISPLAY ARRAY dialog statement, and you are asking how to code the use of TABLE in a .per.

Or are you asking a more advanced question, where you have defined an ARRAY with DIMENSION 2 and are looking for guidance on how to display that particular type of array?

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Wee Ting C.
Posts: 23


« Reply #2 on: November 09, 2017, 06:42:37 am »

Hi Rueben,

Let said I want to display data consists of campus, faculty, level, course, total_student, scholarship, total_scholarship where there is 5 types of scholarship, i.e. A, B, C, D and E. The campus, faculty, level, course, total_student will be assigned to array first dimension while scholarship and total_scholarship will be assigned to array second dimension. How can I write the 4GL and display the array as screen record in per file? And how to define the array variable in static and dynamic array?

Your help is much appreciated.

Thank you.

Regards,
Cheong
Reuben B.
Four Js
Posts: 1049


« Reply #3 on: November 12, 2017, 11:48:05 pm »

Hi Rueben,

Let said I want to display data consists of campus, faculty, level, course, total_student, scholarship, total_scholarship where there is 5 types of scholarship, i.e. A, B, C, D and E. The campus, faculty, level, course, total_student will be assigned to array first dimension while scholarship and total_scholarship will be assigned to array second dimension. How can I write the 4GL and display the array as screen record in per file? And how to define the array variable in static and dynamic array?

Your help is much appreciated.

Thank you.

Regards,
Cheong

I don't think you have provided enough information for anyone to give you a definitive solution.  If I was a junior developer in this situation I would be going back and asking for database schema (if I was to guess I'd say dimension tables for campus, faculty, level, course, student, where the table for student contained a column containing scholarship grade (A-E) and what campus/faculty/level/course they were enrolled in) and a mock screenshot of what was required.

Following the tutorial here http://4js.com/online_documentation/fjs-genero-manual-tutorial-html/#genero-tutorial-topics/c_fgl_TutChap07_001.html you could produce a screen that lists a row for each student showing their campus/faculty/level/course/scholarship in seperate columns but I suspect you want to summarise that.

So I suspect you may end up with an array similar to ...

Quote
define arr dynamic array of record
   campus_id integer,
   campus_name string,
   faculty_id integer,
   faculty_name string,
   level_id integer,
   level_name string,
   course_id integer,
   course_name string,
   student_total integer,
   scholarship_a integer,
   scholdarship_b integer,
   scholarship_c integer,
   scholarship_d integer,
   scholarship_e integer,
   scholarship_total integer
end record

taken through to a screen that could look like

Code
  1. Campus  Faculty  Level  Course  Student Count  A-Schol  B-Schol  C-Schol  D-Schol  E-Schol  Total Schol
  2. Xxxxxx  Xxxxxxx  99999  XXXXXX           9999      999      999      999      999      999         9999
  3. Xxxxxx  Xxxxxxx  99999  XXXXXX           9999      999      999      999      999      999         9999
  4. Xxxxxx  Xxxxxxx  99999  XXXXXX           9999      999      999      999      999      999         9999
  5.                                Total     9999      999      999      999      999      999         9999

but I'd want to know for sure that is what you wanted before coding.

Reuben





Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Wee Ting C.
Posts: 23


« Reply #4 on: November 13, 2017, 09:14:36 pm »

Hi Reuben,

Thank you for your feedback.

However, I would like to know how to write the 4GL and per file for the 2-dimensions array which campus, faculty, level, course, and total_student in 1st-dimension while scholarships and total_scholarship in 2nd-dimension. The scholarship also dynamic.

Thank you.

Regards,
Cheong
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines