Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pulling out a specific field in a record 1

Status
Not open for further replies.

westover

IS-IT--Management
Jul 17, 2002
2
US
question: how do i "grab" a specific field in a specific record to display on a form? e.g. the database has x records with 5 fields per record..how can i grab say the 3Rd field (number) in the 8TH record..in alpha4v6, the command was: dbsum("database","index","record number","field name")..i.e: dbsum("printdoc.dbf","xline","8","mtdunits"), where the database was printdoc, the index was by line number (xline),the record number was 8, and the target field was mtdunits. This number could then be manipulated (averaged etc.) and placed on a form such as a daily operating control.

your assistance is of course greatly appreciated...
 
Are you using Crystal Reports to do this? It doesn't sound like.

If Crystal is used to create the form and you need a selected record to appear in a certain position on the form, you can use a sub-report to return only the required information.

If you can explain the problem in more detail, I can offer more assistance. Steve Phillips, Crystal Consultant
 
I AM TRYING TO USE CRYSTAL REPORTS TO CREATE A DAILY OPERATING CONTROL FOR THE BUSINESS...MY DATABASE IS COMPRISED OF 87 RECORDS, FIVE FIELDS PER RECORD-> (DOC NUMBER, TYPE,LINE NUMBER,MTDUNITS,MONTHTD).THE 5th RECORD HAS THE SALES ON INTEGRA AUTOMOBILES FOR THE CURRENT MONTH.
I.E 1 / G / 5 / 12 / 6034 WHERE 1 = DOC NUMBER(SAME THRUOUT) G IS THE TYPE OF ENTRY (GENERAL) 5 IS THE RECORD NUMBER, 12 NUMBER OF CARS SOLD, 6034 THE TOTAL GROSS.I NEED TO PULL OUT THE NUMBER OF INTEGRAS(12) AND THE GROSS (6034) AND PLACE THESE NUMBERS ON A FORM WITH AN AVERAGE, SUCH AS:
INTEGRAS 5 6034 1207
WITH ALPHA 4V6 THE COMMAND WAS: DBSUM("PRINTDOC", "XLINE"(THE INDEX),5,MTDUNITS")GIVES#OFINTEGRAS
DBSUM("PRINTDOC","XLINE","5","MONTHTD")GIVES GROSS OF 6034
 
It almost sounds as though you need a querying tool rather than a reporting tool. By that I mean that Crystal is very good at presenting lists of information and showing summaries, counts, totals etc.

You seem to want to look at a particular value in a particular row in the database. I normally use an Oracle database and I would use SQL Plus to get a single piece of info from the database rather than Crystal.

Please forgive me if I am out-of-line here, but I am assuming you are very new to Crystal. In which case, can you tell me what database you are using (e.g. Oracle, Access, SQL Server etc), and how Crystal is to know which row of the 87 it is to show you. Steve Phillips, Crystal Consultant
 
Crystal is more SQL like in it's handling of databases.

To limit the rows, use the record selection criteria:

Report->Edit Selection Formula->Record

You can select your database fields from the list above, then use criteria against them:

{MyTable.Gross} = 6034

and

{MyTable.CarsSold} = 12

etc.

Use as many as required to qualify the record.

You can also create parameters to prompt users to put in these values so that the report is dynamic.

Insert->Field Object

You would then use the parameters in place of the literal values in the above example.

-k kai@informeddatadecisions.com
 
Place the fields you want on the detail section of your repport, then write a formula to only display the 5th record.

To do thism right click on the detail section. select format section, click the X-2 button to the right of suppress and enter the following formula:

Recordnumber <>5 Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
If you decide to follow the Crystal route, the only other &quot;trick&quot; you will need is to create and insert a formula to calculate the average value. Steve Phillips, Crystal Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top