Conditional row processing

This feature of GPaediaMaker allows you to control the processing of special labeled CSV file rows with the INI file specifications valid_rows, valid_driver_rows, valid_teamrows and valid_trackrows. Labeling is done by adding a # as the first character of the first (english) columns entry in the format CSV file followed by a space or a number (1 or 2). The corresponding rows in the data CSV file have the same header as the format file but without the #n label.
You have to specify "user_format = 1" in your INI file when using conditional row processing.
Example #1 shows different ways of marking a row and how to use them. It is based on gpaedia development for the 1993mod by GP4Central.
Example #2 shows how to select alternate team table rows "Drivers". It is taken from a generation of GPaedia for a 2001 CSM mod and includes the use of the transform function _%Drivers%.

Example #1: Different row markers

The gpaedia for the 1993mod by GP4Central was created in different steps. First only english gpaedia files were made by jcaranti. Then these were read into data sheets for recreation with GPaediaMaker thus getting the other language GPS files. Some data was added into the driver and team table during this process of which only the team tables data should be used for the updated gpaedia. Therefore the new driver data rows are # labeled to leave them out, while the new team table rows were #1 labeled for conditional output. The conditional row processing makes it possible to produce gpaedia with and without - for comparison with the original one - the added content. Because replace drivers are added, the "Drivers" row of the team table should be conditionally extended adding the replace drivers to the standard ones. To accomplish this a row "Drivers plus" was included and #2 labeled.

Driver format and data

English . . . Transform Lineformat
Name
#name
Team
#team
Date of Birth
_birthdate \$\:\%\n
Nationality
_nat \$\:\%\n
First GP
_firstgp \$\:\%\n
Previous Teams
_list-Teams \$\:\%\n
# World Champion
_ \$\:\%\n
-1993 stats-

\$\n
Grand Prix Starts
_ \$\:\%\n
Championship Position
_best \$\:\%\n
Points Scored
_decimal \$\:\%\n
Best Result
_best \$\:\%\n
Best Qualifying
_best \$\:\%\n
# Fastest Laps
_ \$\:\%\n
# Podiums
_ \$\:\%\n
driver replace
#offset
1993 1 2 . . .
Name Damon Hill Alain Prost
Team Williams Renault Williams Renault
Date of Birth 17/08/1960 24/02/1955
Nationality British French
First GP Spain 1992 Argentina 1980
Previous Teams Brabham "McLaren, Renault, Ferrari
World Champion 0 3 (1985-86, 1989)
-1993 stats-


Grand Prix Starts 16 16
Championship Position 4th 1st
Points Scored 69 99
Best Result 3 wins 7 wins
Best Qualifying 1 pole 7 poles
Fastest Laps 4 6
Podiums 10 12
driver replace


The labeled rows of the driver table are intentionally never processed, because there are already enough entries in the drivers gpaedia.
Because looking for data of a F1 season is pretty time consuming, it is a good idea to put all that is available into the data sheet at first try and label out with #, what should not be used for actual gpaedia.

Team format and data

English . . . Transform Lineformat
Team
#team
Team (short)
#team
Team Nationality
_nat \$\:\%\n
Founded
_ \$\:\%\n
F1 Debut

\$\:
Debut year
_ \%,_
Debut GP
_grandprix \%\n
Headquarters
_res \$\:\%\n
Team manager
_list-names \$\:\%\n
Drivers
_list-names \$\:\%
#2 Drivers plus
_list-names ,_\%
LF

\n
#1 -1993 stats-

\$\n
#1 Best Result
_best \$\:\%\n
#1 Best Qualifying
_best \$\:\%\n
#1 Points
_ \$\:\%\n
#1 Championship Position
_best \$\:\%\
1993 1 2 3 . . .
Team Williams Renault Benetton Ford McLaren Ford
Team (short) Williams Benetton McLaren
Team Nationality British British British
Founded 1968 1970 1963
F1 Debut



Debut year 1972 1986 1966
Debut GP British Grand Prix Brazilian Grand Prix Monaco Grand Prix
Headquarters Didcote, UK Witney, UK Woking, UK
Team manager Frank Williams, Patrick Head Flavio Briatore, Ross Brawn Ron Dennis
Drivers Alain Prost, Damon Hill Michael Schumacher, Ricardo Patrese Ayrton Senna, Michael Andretti
Drivers plus # # Mika Häkkinen
LF



-1993 stats-



Best Result 10 wins 1 win 5 wins
Best Qualifying 15 poles 2nd 1 pole
Points 168 72 99
Championship Position 1st 3rd 2nd


Output variants

Using the valid_rows specification in the INI file we can now produce different outputs:

 1. no valid_rows specification: not any of the labeled rows are processed
 2. valid_rows = 1             : all #1 labeled rows are processed
 3. valid_rows = 2             : all #2 labeled rows are processed (that is only 1 team table row in this case)
 4. valid_rows = 3             : all #1 and #2 labeled rows are processed
 5. valid_teamrows = 1         : only the #1 labeled rows of the team table are processed
 6. valid_teamrows = 2         : only the #2 labeled row of the team table is processed
 7. valid_teamrows = 3         : #1 and #2 labeled rows of the team table are processed
In the example given, cases 2 and 5, 3 and 6, 4 and 7 are producing the same result, because only the team table has #1 resp. #2 markers.
Case 1 is used to create the gpaedia corresponding to the original one.
Case 2 resp. 5 is used to create updated gpaedia without replace drivers.
Case 4 resp. 7 is used to create updated gpaedia including replace drivers.
Using different INI files these outputs can be created from the same CSV files.
The team table "Drivers" row is split into the three rows "Drivers", "Drivers plus" and "LF". The output of these rows is written into the same line because no line feed (\n in the Lineformat column) is provided within the "Drivers" or "Drivers plus" rows. The "Drivers plus" row is #2 labeled for conditional processing and may not be processed. Therefore we need an extra linefeed row LF.

Example #2: Alternate row selection

In this example a team table for a F1 2001 CSM mod is formatted in a way that gpaedia can be created for two alternatives:
#1: full season,
#2: trackspecific.
To do this, we use the "conditional row processing" feature as well as the transform function _%Drivers%.

Team format and data 2001

English . . . Transform Lineformat
Team
#team
Team (short) #team
Team Principal
_name \$\:\%\n
Technical Director
_name \$\:\%\n
#1 Drivers
_list-Names \$\:\%\n
#2 Drivers
_%Drivers% \$\:\%\n
Team Nationality
_nat \$\:\%\n
Team Base
_res \$\:\%\n
Number of years in F1

\$\:\%\n
Number of wins

\$\:\%\n
Number of drivers titles

\$\:\%\n
Number of constructors titles

\$\:\%\
2001 1 . . . 10 11
Team ferrari
minardi european prost acer
Team (short) ferrari minardi prost
Team Principal Luca di Montezemolo Paul Stoddart Alain Prost
Technical Director Ross Brawn Gustav Brunner Henri Durand
Drivers Michael Schumacher, Rubens B. Tarso Marques, Fernando Alonso Jean Alesi, Luciano Burti
Drivers Michael Schumacher, Rubens B. %drivera%, Fernando Alonso %drivera%, %driverb%
Team Nationality Italian Italian French
Team Base Maranello, Italy Faenza, Italy Guyancourt, France
Number of years in F1 51 16 4
Number of wins 135 0 0
Number of drivers titles 10 0 0
Number of constructors titles 10 0 0


With the transform function _%Drivers% the entries %drivera% and %driverb% are replaced by the drivernames of the team in the driver table considering the replace driver.
The function _%Drivers% writes the english drivernames uppercase (as in all other languages) even if they were lowercase in the table, while the function _%drivers% would have not converted them to uppercase.

Output variants

Using the valid_rows specification in the INI files we will now produce two different outputs:

#1: INI file for full season GPS:

...
; gps file names (normal)
ln_gps = GP%season%_%language%.gps

; gps file names trackspecific
;track_gps = GP%season%_%language%-%tracknum%.gps

; Use user defined format files (default = 0)
user_format = 1

; conditional row processing
valid_teamrows=1

5 GPS files are created that get the team gpaedia drivers specified in the team table row "#1 Drivers".

#2: INI file for trackspecific GPS:

...
; gps file names (normal)
;ln_gps = GP%season%_%language%.gps

; gps file names trackspecific
track_gps = GP%season%_%language%-%tracknum%.gps

; Use user defined format files (default = 0)
user_format = 1

; conditional row processing
valid_teamrows=2
...

; different log file 
log_file = gpaedia-ts

20 trackspecific GPS files for tracks 5, 8, 13 and 15 are created, that get team gpaedia trackspecific drivers.
With a different log file used by the second run the log file of the first run is not overridden.

Remarks