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: Dynamic Input Table  (Read 7394 times)
Gary C.
Posts: 109


« on: August 25, 2011, 01:08:42 pm »

Hi

Not sure if this is possible but thought I would ask anyway.

Our application deals with garments and quite often presents data to the user in a table where each row of the table represents a colour of the garment and each column a size of the garment. The number of colours and sizes per garment is obviously variable.

The challenge I am facing relates to the variable number of columns. Using the DOM I am able to dynamically build a table with the desired number of columns visible. This works very well.

However, when it comes to the INPUT ARRAY statement I need a local record which matches the record set in the form. As I do not know in advance how many columns I need I end up with error 1109 "List and record field counts differ". To get over this I assume a maximum number of columns and define my local record and build the table to match. If the actual number required is less, I simply hide the unwanted columns.

This works well but having to set the maximum is proving a little restrictive when dealing with certain products. I was just wondering if anyone else had required anything similar and could share their experience.

Regards

Gary

Reuben B.
Four Js
Posts: 1049


« Reply #1 on: August 26, 2011, 01:25:06 am »

Back 6,7 years ago when I first migrated the application I was working on into Genero, I had the similar problem.  For our customers who sold shoes, clothing etc they all had this additional level of detail we called "colour and size" so that when ordering, as well as specifying that they ordered 1000 of a product, you had to determine how many of each colour and size combination was to be ordered.

We had a similar solution to what you described.  Pick an arbitrarily large number for the number of columns, name your columns size01, size02, size03 etc.  Use DOM Tree manipulation to give each column an appropriate title (Small/Medium/Large or 4,4.5,5,5.5 etc), and Dom Tree manipulation to hide the columns that weren't used.  Then INPUT ARRAY to enter the values, or DISPLAY ARRAY to simply view them.  We also had functionality to select an individual cell but as DISPLAY ARRAY will only tell you what row you have selected it, this had to be an INPUT ARRAY where we ignored what the user keyed in, and when they pressed ENTER determined the selected colour/size by interrogating the current field and row.

In the last few years working for FourJs A/P I've seen lots of similar code.  The one approach I've seen different was someone who didn't need to edit the data, they just needed to view it.  They used a TEXTEDIT with textFormat=html, and created an HTML table with a variable number of rows and columns and displayed it to the TEXTEDIT, just be careful if you have a large number of rows/columns with this technique as the whole TEXTEDIT value is sent to the GDC, not just the visible rows and columns.

I haven't seen anyone attempt to use a WEBCOMPONENT to solve this issue.  I had a brief look at using a PivotTable WEBCOMPONENT (see attached screenshot) and there would be a potential solution in that direction as well.

There is a number in the system to track who would benefit from a widget designed to work with two or three dimensional arrays.  If you want to add your name to it, ask your support contact to add you to the list of requestors for Bz16643.  IMHO we lack a suitable widget  that would act as the default widget/container for 2 or 3 dimensional arrays, similar to how we lack a suitable widget for DATETIME and INTERVALS.

Reuben


* pivot_web.png (80.17 KB, 1030x614 - viewed 1378 times.)

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines