<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://stadtsprachen.kallimachos.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3AUniquePropertyValues</id>
	<title>Modul:UniquePropertyValues - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://stadtsprachen.kallimachos.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3AUniquePropertyValues"/>
	<link rel="alternate" type="text/html" href="https://stadtsprachen.kallimachos.de/index.php?title=Modul:UniquePropertyValues&amp;action=history"/>
	<updated>2026-06-15T01:52:24Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Stadtsprachen</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://stadtsprachen.kallimachos.de/index.php?title=Modul:UniquePropertyValues&amp;diff=11153&amp;oldid=prev</id>
		<title>Nöth: Die Seite wurde neu angelegt: „local p = {}  function p.getUniqueValues(propertyName)     -- Handle case where propertyName is passed as a table     if type(propertyName) == &quot;table&quot; then         propertyName = propertyName[1]  -- Extract the first argument     end          -- Ensure the property name is provided     if not propertyName or propertyName == &quot;&quot; then         error(&quot;Property name required&quot;)     end          -- Query all pages with this property     local ask = mw.smw.ask({…“</title>
		<link rel="alternate" type="text/html" href="https://stadtsprachen.kallimachos.de/index.php?title=Modul:UniquePropertyValues&amp;diff=11153&amp;oldid=prev"/>
		<updated>2024-11-04T10:07:23Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „local p = {}  function p.getUniqueValues(propertyName)     -- Handle case where propertyName is passed as a table     if type(propertyName) == &amp;quot;table&amp;quot; then         propertyName = propertyName[1]  -- Extract the first argument     end          -- Ensure the property name is provided     if not propertyName or propertyName == &amp;quot;&amp;quot; then         error(&amp;quot;Property name required&amp;quot;)     end          -- Query all pages with this property     local ask = mw.smw.ask({…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.getUniqueValues(propertyName)&lt;br /&gt;
    -- Handle case where propertyName is passed as a table&lt;br /&gt;
    if type(propertyName) == &amp;quot;table&amp;quot; then&lt;br /&gt;
        propertyName = propertyName[1]  -- Extract the first argument&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Ensure the property name is provided&lt;br /&gt;
    if not propertyName or propertyName == &amp;quot;&amp;quot; then&lt;br /&gt;
        error(&amp;quot;Property name required&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Query all pages with this property&lt;br /&gt;
    local ask = mw.smw.ask({&lt;br /&gt;
        &amp;quot;[[&amp;quot; .. propertyName .. &amp;quot;::+]]&amp;quot;,  -- Select all pages where the property is defined&lt;br /&gt;
        &amp;quot;?&amp;quot; .. propertyName,              -- Ask for the value of the property&lt;br /&gt;
        &amp;quot;limit=500&amp;quot;                       -- Increase limit if necessary&lt;br /&gt;
    })&lt;br /&gt;
    &lt;br /&gt;
    -- Create a table to store unique values&lt;br /&gt;
    local uniqueValues = {}&lt;br /&gt;
    &lt;br /&gt;
    -- Iterate through results and collect unique values&lt;br /&gt;
    if ask then&lt;br /&gt;
        for _, result in ipairs(ask) do&lt;br /&gt;
            if result[propertyName] then&lt;br /&gt;
                -- Check if the result is a table (multiple values) or a string (single value)&lt;br /&gt;
                if type(result[propertyName]) == &amp;quot;table&amp;quot; then&lt;br /&gt;
                    for _, value in ipairs(result[propertyName]) do&lt;br /&gt;
                        -- Ensure that the value is not empty or nil&lt;br /&gt;
                        if value and value ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                            uniqueValues[value] = true&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                elseif type(result[propertyName]) == &amp;quot;string&amp;quot; then&lt;br /&gt;
                    -- Single value case&lt;br /&gt;
                    local value = result[propertyName]&lt;br /&gt;
                    if value and value ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                        uniqueValues[value] = true&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Convert the unique values to an array and sort&lt;br /&gt;
    local valueArray = {}&lt;br /&gt;
    for value in pairs(uniqueValues) do&lt;br /&gt;
        table.insert(valueArray, value)&lt;br /&gt;
    end&lt;br /&gt;
    table.sort(valueArray)&lt;br /&gt;
    &lt;br /&gt;
    -- Return the array of unique values&lt;br /&gt;
    return valueArray&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Nöth</name></author>
	</entry>
</feed>