Page 1 of 1

Workingn with 3D Chart Data

Posted: Thu Dec 11, 2014 1:39 pm
by rjiron
3D Chart data

How do you initialize the Chart Data fields?
In Profound UI, I’m using 3D Chart Data and defining fields for Names and Values with length of 1000 char, in the RPG program I’m loading Year and Amount into a VARYING fields, then, moving those values in the Chart fields, the first time, work just fine; but, when I’m trying to inquiry a different product code, is adding more bars into the existing chart, but, if I try to initialize those fields before loading the new info, it’s does not show any bars. Any idea what I’m doing wrong?

Re: Workingn with 3D Chart Data

Posted: Thu Dec 11, 2014 4:33 pm
by Scott Klement
If you leave the old data in the variables, and only add the new data on, then yes it'll just add more bars. You need to remove the old data and if you don't want it to display in the grid.

You say that when you initialize them (presumably by this you mean clear them) and put the new data in them that you don't get a chart. Can you tell us what the variables look like at that time?

Re: Workingn with 3D Chart Data

Posted: Thu Dec 11, 2014 5:34 pm
by rjiron
Profound UI Screen:
Bind name to a program field

Code: Select all

Field Name            Data Type        Length
WYDATA1X             Character         1000             // Year
W$DATA1X             Character         1000             // Amount
RPGLE CODE:

Code: Select all

D Chartdatay         s          1000a  VARYING
D Chartdata$         s          1000a  VARYING   

WYDATA1X = *Blanks;              // Chart Data Profound UI Field Name  (If I do this, Not data in Chart)
                                              // If I remove this line, I get the Chart info.

* Loading from Array to Chartdatay/Chartdata$ fields 
For i = 1 to 12;
  If WYDATA(i) <> 0;
    Chartdatay += %CHAR(Wydata(i))+ ',';                  
    Chartdata$ += %CHAR(W$data(i))+ ',';
  endif;
endfor;

Wydata1x = Chartdatay;                 //  Moving data to Profound UI Field
W$data1x = Chartdata$;                 // and there is some values, but is not passing those values into (WYDATA1X/W$DATA1X) fields

ExFmt Chart1                                // Displaying Format
That's all that I'm doing, nothing complex and there is some values in the (Chartdatay/Chartdata$) fields

Re: Workingn with 3D Chart Data

Posted: Thu Dec 11, 2014 5:49 pm
by Scott Klement
The line where you're blanking out WYDATA1X won't make any difference at all, because you are completely replacing that field later on in the routine. At that point in the program, you should be clearing Chartdatay and Chartdata$ instead.

Code: Select all

Chartdatay = '';
Chartdata$ = '';
The other problem that I can see (at a quick glance) is that you are adding an extra comma to the data. So the data will always end with a comma. I would consider changing your loop to something like this:

Code: Select all

Chartdatay = '';
Chartdata$ = '';

For i = 1 to 12;
  If WYDATA(i) <> 0;
    if Chartdatay = '';
      Chartdatay = %char(Wydata(i));
      Chartdata$ = %char(W$data(i));
    else;
      Chartdatay += ',' + %CHAR(Wydata(i));
      Chartdata$ += ',' + %CHAR(W$data(i));
    endif;
  endif;
endfor;

Wydata1x = Chartdatay;
W$data1x = Chartdata$;
So the idea is that on th efirst time data is found, you add that data by itself, but if adding to existing data, you add a comma, then the data. That way your data will end up like '1,2,3,4' instead of '1,2,3,4,' -- that final comma might be causing problems.

This is just off the top of my head, but give it a try and see if it works.

Re: Workingn with 3D Chart Data

Posted: Thu Dec 11, 2014 6:23 pm
by rjiron
Scoot, You are a genius; that was the problem, it's up and running, !! great !!

Thank you so much.