Focal Point
Maintain data source stacks / identically named fields in different segments

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1781001592

August 11, 2008, 12:48 PM
J. Erickson
Maintain data source stacks / identically named fields in different segments
I searched the forums and looked through the 7.6.1 Maintain manuals but couldn't find anything that confirms if Maintain data source stacks can't contain identically named fields from different segments in a master.

For example, I have a master "jobs".

FILENAME=ELEMENTS, SUFFIX=FOC     , $
  SEGMENT=JOB, SEGTYPE=S1, $
    FIELDNAME=NAME, USAGE=A8,
      TITLE='Job Name', $
    FIELDNAME=FREQ, USAGE=A1,
      TITLE='Job Freq', $
    FIELDNAME=DESC, USAGE=A150V,
      TITLE='Job Description', $
  SEGMENT=FILE, SEGTYPE=S1, PARENT=JOB, $
    FIELDNAME=NAME, USAGE=A36V,
      TITLE='File Name', $
    FIELDNAME=DESC, USAGE=A150V,
      TITLE='File Description', $


In the MDE I use the Stack Editor to create a new data source stack named stkFiles. I select the NAME field in the FILE segment. This puts the NAME field from the JOB segment plus NAME and DESC from the FILE segment into the right hand window and this looks correct. I also see the command that will be generated:
Infer elements.FILE.NAME into stkFiles;


When I click OK, though, the command that's put into my Maintain procedure is:
Infer elements.JOB.NAME into stkFiles;


It seems that Maintain is getting confused because of the identically named fields in the 2 different segments.

I've also just tried entering the Infer statement manually as:

infer elements.JOB.NAME elements.FILE.NAME into stkFiles;


When I look at stkFiles in the Project Explorer I only see 3 fields, NAME, DESC, and FREQ. So it seems that Maintain won't see the other NAME and DESC fields in the FILE segment.

I'm just wondering if someone can verify that what I'm seeing here is true. I guess I'll have to make sure all my fields in this master have unique names no matter if they're in different segments.

Thanks!


FOCUS 7.7.03
WebFOCUS 8.0.x/8.1
z/OS, Windows
August 11, 2008, 12:49 PM
J. Erickson
Actually the master is named elements.


FOCUS 7.7.03
WebFOCUS 8.0.x/8.1
z/OS, Windows
August 11, 2008, 02:08 PM
Maintain Wizard
When using Maintain, you do need to have unique field names in the Master.

The problem is when you load the data into a stack (or current area). If you have 2 fields with the same name in the same Master, Maintain cannot distinguish WHICH of the fields that you are referencing. The same problem occurs if you compute a field into a stack that already exists from either the database or a previous compute.

This problem won't occur when you have combined structures, since a stack can only reference on database.

Mark
August 12, 2008, 05:33 PM
Waz
I think you have two solutions to this.

1. Change the Master to have different key fields.
2. Call a FEX, have the FEX rename the fields and return the table.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

August 12, 2008, 06:57 PM
Dan McDonald
Waz,

I just had the same problem. We had to put a filename qualifier in front of the field name.

Example :I had a few files fileA and fileB with the duplicate field name of AMOUNT.

If I needed to pick the second file amount, I would use:

fileB.AMOUNT.

Just keep qualifying the filename and it should work.


Dan McDonald
Version : 7.7.01
Platform:WindowsOutput : Excel, PDF, HTML