Test-ParserFunctions-in-ExternalData: Difference between revisions

From sandbox
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 45: Line 45:




{| class="wikitable"
{| class="wikitable sortable"
! Name
! Role
! Role
! Wiki User Page
! First Name
! Email  
! Last Name
! WikiUsername
!class=unsortable| Wiki User Page
 
!class=unsortable| Email  
{{#display_external_table:template=ManagerData|data= Name=Name, Role=Role, Email=Email, WikiUsername=WikiUsername, FirstName=FirstName, LastName=LastName }}
! WikiUsername {{#display_external_table:template=ManagerData|data= Name=Name, Role=Role, Email=Email, WikiUsername=WikiUsername, FirstName=FirstName, LastName=LastName }}
|}
|}



Latest revision as of 23:30, 24 May 2020

Testing combined use of GetExternalData and ParserFunctions extensions

This page was created to test a variety of methods for combining the functionality of the GetExternalData extension with the ParserFunctions extension. Initial attempts to use the two extensions together failed. Though the documentation isn't entirely clear, it appears that since both extensions use the MediaWiki template functionality (using curly braces "{ }" that there is some incompatibility.

The reason we need to use ParserFunction extension is to allow us to make minor changes of the data imported by GetExternalData. For example, the data contains a column named 'Role' that describes the person's role, whether they are a Manager, Staff, or Advisor. Managers are unpaid volunteers while Staff and Advisers are paid. Using ParserFunction conditionals we can group Staff and Advisers together under the label 'Non Volunteer' while Managers are labelled 'Volunteer'

Another important reason for conditional testing relates to the need to handle a field differently for different rows. For example, not all Managers have created a user page. We don't keep track of this in the spreadsheet. When we create a link to the user page for each Manager, we can test for the existence of that page and not create a link if the page doesn;t exist.

Testing will continue but for the immediate future, we have found that using the Display_External_Table format option does work. This option requires the creation of a template for each query and the presence of variable names in both the wiki page and the template makes maintenance somewhat confusing.


Test Case:

Display the current Manager / Staff roster from Google Sheet CSV web feed via the CSV import capability of the GetExternalData extension. Display the Name, email address, Wiki User Name, a link to that person's User page (if it exists), and whether that person is a volunteer or not.

Use #ifexist and #ifeq conditionals in the ParserFunctions Extension to "clean up" the import, for example, ensuring that we only show links to a wiki user page if that user page actually exists.



GetExternalData provides several ways to display the retrieved data on the wiki page. These are:

  • Displaying individual values
  • Displaying a table of values
  1. for_external_table
  2. display_external_table



Use Display External Table

Role First Name Last Name Wiki User Page Email WikiUsername

ManagerData Template:


|- | {{{Role}}} | {{{FirstName}}} | {{{LastName}}} | User:{{{WikiUsername}}} (Page not created)
([[special:Contributions/{{{WikiUsername}}} | {{{FirstName}}}'s Wiki Contributions]]) | send email

Try using display_external_table without table markup.

Name Wiki User Page Role Test


ExternalData without wiki table markup

{{{Name}}} ({{{Email}}}) is WikiUser {{{WikiUsername}}} ({{{Role}}}) and is not a volunteer User Page Doesn't Exist.