Changes
If Wikidata property has multiple values, only use first one. Fix for empty name parameter. Remove {{Trim|}} since {{#if:}} does same. Tested with /sandbox, /testcases and article using Wikidata.
{{#if: {{{1<includeonly>|</includeonly>}}} {{{id|}}} {{#property:P1146}}
| [https://www.iaaf.org/athletes/biographies/athcode={{#if: {{{1|{{{id<includeonly>|</includeonly>}}}}}} | {{{1|{{{id}}}}}} | {{First word|1={{#property:P1146}}|sep=,}} }} {{#if: {{{2|{{{name<includeonly>|</includeonly>}}}}}} | {{{2|{{{name}}}}}} | {{PAGENAMEBASE}} }}] at [[International Association of Athletics Federations|IAAF]]<includeonly>{{EditAtWikidata|pid=P1146|{{{1|{{{id|}}}}}}}}{{Main other|{{#if:{{{1|{{{id|}}}}}}|{{#if:{{#property:P1146}}|{{#ifeq:{{{1|{{{id|}}}}}}|{{#property:P1146}}||[[Category:IAAF ID different in Wikidata]]}}|[[Category:IAAF ID not in Wikidata]]}}}}}}</includeonly>
| <span class="error">{{[[Template:IAAF name|IAAF name]]}} template missing ID and not present in Wikidata.</span>{{Main other|[[Category:IAAF template with no ID]]}}
}}<noinclude>
{{Documentation}}<!-- Please add categories to the /doc subpage & add interwikis to Wikidata. -->
</noinclude>
| [https://www.iaaf.org/athletes/biographies/athcode={{#if: {{{1|{{{id<includeonly>|</includeonly>}}}}}} | {{{1|{{{id}}}}}} | {{First word|1={{#property:P1146}}|sep=,}} }} {{#if: {{{2|{{{name<includeonly>|</includeonly>}}}}}} | {{{2|{{{name}}}}}} | {{PAGENAMEBASE}} }}] at [[International Association of Athletics Federations|IAAF]]<includeonly>{{EditAtWikidata|pid=P1146|{{{1|{{{id|}}}}}}}}{{Main other|{{#if:{{{1|{{{id|}}}}}}|{{#if:{{#property:P1146}}|{{#ifeq:{{{1|{{{id|}}}}}}|{{#property:P1146}}||[[Category:IAAF ID different in Wikidata]]}}|[[Category:IAAF ID not in Wikidata]]}}}}}}</includeonly>
| <span class="error">{{[[Template:IAAF name|IAAF name]]}} template missing ID and not present in Wikidata.</span>{{Main other|[[Category:IAAF template with no ID]]}}
}}<noinclude>
{{Documentation}}<!-- Please add categories to the /doc subpage & add interwikis to Wikidata. -->
</noinclude>