Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     FOC file - multiple indexes?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
FOC file - multiple indexes?
 Login/Join
 
<Unfocused>
posted
Can a FOC file have more than one index?
I'd like to do something like-:

TABLE FILE CAR
PRINT *
ON TABLE HOLD AS CARIX FORMAT FOCUS INDEX MANUFACTURER INDEX2 MODEL
END

Is the only way to do this by having two hold files, one for INDEX MANUFACTURER and one for INDEX MODEL?

thanks
 
Report This Post
Silver Member
posted Hide Post
Yes, a 'FORMAT FOCUS' file can have up to 4 fields indexed this way. At least with the versions of FOCUS I have worked with.

Later versions may be more, but I wouldn't expect less.
 
Posts: 40 | Registered: March 10, 2004Report This Post
Silver Member
posted Hide Post
just list the fields you want after the word INDEX, there is no INDEX2 kwyword.

i.e.

INDEX MANUFACTURER MODEL

hth, drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
Expert
posted Hide Post
Un, short answer: yes indeed, focus files can have a bunch of indices;
i believe index fields must be key fields. At least i've always thought so. (ps: but not so, see Noreen's cool example below)
yet all key fields do not have to have indices
TABLE FILE CAR
SUM SEATS WEIGHT REVENUE
BY CAR BY COUNTRY BY MODEL BY WHATEVER
ON TABLE HOLD AS MYCAR FORMAT FOCUS
INDEX CAR COUNTRY MODEL WHATEVER
END
..the index names referenced in the INDEX statement don't seem to have to be in any specific order. and they don't have to be all in one segment. they can be from any segment.
i've got files with 8 indices, working fine.
just ordinary focus files, not even xfocus.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Non-key fields can be indexed.

The total number of segments and index structures in a FOCUS file is limited (by the structure of the FDT) to 64. XFOCUS limits are higher.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
OK, to recap.
You can have specify multiple indexes in a HOLD FORMAT FOCUS file, and they need not be keys. In older releases (pre 708) in FOCUS, the number of indexes + number of segments must be less than 1024, but the number of segments is still limited to 64. It is important that you can put an index on a non-key field, as I sometimes use COMPUTE to create a multi-field index so that I can JOIN on multiple fields. ie TABLE FILE CAR SUM COMPUTE INDX/A24 = COUNTRY | CAR; SALES BY COUNTRY NOPRINT BY CAR NOPRINT ON TABLE HOLD AS ABC FORMAT FOCUS INDEX INDX
 
Posts: 60 | Location: 2 penn | Registered: May 22, 2003Report This Post
<Unfocused>
posted
Thanks using FORMAT FOCUS worked.
 
Report This Post
Platinum Member
posted Hide Post
Sorry for the interuption, but I am a bit confused. Coming from a strict SQL background, maybe the concept of indexes(sp?) is different. In SQL, multiple Indexes means more than one index with various feilds making up index.

I.e.
Create Index INDex1 as f1, f2, f3;
Create Index INDex2 as f4, f5, f6;

Is the meaning different for Focus? From the answers above it seems that way. To me it looks like you are referring to multiple FIELD indexes. could someone clarify for me?
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
Gold member
posted Hide Post
You are right LLoyd, we are taking at least two different things.
1) Single field indexes on multiple fields.
that you create by HOLD FORMAT FOCUS INDEX field1 field2 field3. You will then have separate indexes for field1, field2, and field3.

2) Multi-field index. Now, for WEBFOCUS that is supported with MDI (multimensional index), or you can do this via a COMPUTE to create a new single field that contains the values of all fields to be put into the index. For instance, in the CAR file, I want to index the concatenation of COUNTRY, CAR and BODYTYPE to improve either a JOIN, or selection. In that case, I would have:
TABLE FILE CAR PRINT RCOST DCOST
COMPUTE INDX/A38 = COUNTRY | CAR | BODYTYPE;
BY COUNTRY BY CAR BY BODYTYPE
ON TABLE HOLD FORMAT FOCUS INDEX INDX
END
You can them from another file, JOIN COUNTRY AND CAR AND BODY IN FILE2 TO INDX IN HOLD

Hope that clears it up.
 
Posts: 60 | Location: 2 penn | Registered: May 22, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     FOC file - multiple indexes?

Copyright © 1996-2020 Information Builders