Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListUsing the "filter statement" to compare the username to a name|value pairUsing the "filter statement" to compare the username to a name|value pair
Previous
 
Next
New Post
7/6/2011 10:08 AM
 
I have a list that contains order information for multiple companies.  I have one user for each company who should be able to log in and see a filterded list that shows only their company information.

I was thinking that if I could create a name|value pair for each company using company_name|username and then filter the results based on the logged in user.  Can/should this be done in the "Filter Statement" in the Form and List ConfigurationForm and List Configuration?
 
New Post
7/13/2011 9:08 AM
 




Normal UDT_Table_AlternateItem


Normal UDT_Table_Item















This will only show records for role "CompanyA" where the value of column "Company" is "A". This means you will have to create different filters and elements for each company.

I'm not sure this is the best/easiest way to do this, but I hope it helps.
I don't think you can do this in the Filter Statement when you have a specific filter for each company, at least not in one module. I have done a similar thing by filtering on user role and a value in a hidden column in an XSLT, which seems to work fine. I edited the advancedtable.xsl for this.

First I created another filter:



Categorie is a hidden column and 'Algemeen' and 'A' are the values of that column. In your case I guess it would be something like:



Then I used a choose element which will pick a filter depending on the role of the logged in person:
















 
New Post
7/13/2011 9:10 AM
 
I don't think you can do this in the Filter Statement when you have a specific filter for each company, at least not in one module. I have done a similar thing by filtering on user role and a value in a hidden column in an XSLT, which seems to work fine. I edited the advancedtable.xsl for this.

First I created another filter:

     <xsl:variable name="filteredDataA" select="udt:Data[udt:Categorie='Algemeen' or udt:Categorie='A']" />

Categorie is a hidden column and 'Algemeen' and 'A' are the values of that column. In your case I guess it would be something like:

     <xsl:variable name="filteredDataA" select="udt:Data[udt:Company='A']" />

Then I used a choose element which will pick a filter depending on the role of the logged in person:

           <xsl:choose>
              <!-- Logged in as CompanyA -->
              <xsl:when test="contains(//udt:Context/udt:UserRoles,'|CompanyA|')">
                <xsl:for-each select="$filteredDataA">
                  <!--Sorting-->
                  <xsl:sort select="*[name()=$param_orderby]" order="{$orderDirection}" data-type="{$orderType}" />
                  <xsl:if test="position() &gt; $from and position() &lt; $to">
                    <xsl:variable name="id" select="udt:UserDefinedRowId" />
                    <tr>
                      <xsl:attribute name="class">
                        <xsl:choose>
                          <xsl:when test="position() mod 2=1">
                        Normal UDT_Table_AlternateItem
                      </xsl:when>
                          <xsl:otherwise>
                        Normal UDT_Table_Item
                      </xsl:otherwise>
                        </xsl:choose>
                      </xsl:attribute>
                      <td>
                        <xsl:call-template name="detailLink">
                          <xsl:with-param name="id" select="udt:UserDefinedRowId" />
                        </xsl:call-template>
                      </td>
                      <xsl:for-each select="//udt:Fields">
                        <xsl:if test="udt:Visible='true' or udt:Visible='True'">
                          <td>
                            <xsl:variable name="NameOfValueColumn" select="udt:ValueColumn" />
                            <xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]" disable-output-escaping="yes" />
                          </td>
                        </xsl:if>
                      </xsl:for-each>
                    </tr>
                  </xsl:if>
                </xsl:for-each>
              </xsl:when>
            </xsl:choose>

This will only show records for role "CompanyA" where the value of column "Company" is "A". This means you will have to create different filters and <xsl:when ...> elements for each company.

I'm not sure this is the best/easiest way to do this, but I hope it helps.
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListUsing the "filter statement" to compare the username to a name|value pairUsing the "filter statement" to compare the username to a name|value pair


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out