February 9, 2012  
   Login  
Forum  
 
ForumForumEnesys RS Data ...Enesys RS Data ...Support - RS Da...Support - RS Da...Use of report parametersUse of report parameters
Previous Previous
 
Next Next
New Post
 9/10/2009 3:01 PM
 

I have some trouble with the use of report parameters.

This is part of the query (CAML)

          <Eq>
            <FieldRef Name="DocumentType" />
            <Value Type="Lookup">@rptDocumentType!</Value>
            <IfNot>All</IfNot>
          </Eq>

This works ok except for <null> or <space> values.

I tried to put the parameter in the sqlQuery part:

...where DocumentType=@rptDocumentType!

but this is not understood.

How can I achieve this ?

 

 

New Post
 9/10/2009 5:09 PM
 

Hi michael,

I just tested with a column which can be null, and it works great. I suppose you want to return the items where DocumentType is null.

  1. Do you have a DocumentType which value is empty/null?
  2. Do you have an error thrown?
  3. Did you try to use the Lookup ID instead of the Lookup value (and specify LookupId="true" in the FieldRef node)?

I'm looking forward to hearing from you,

Regards,
Marien Monnier
Enesys

New Post
 9/11/2009 1:08 PM
 
 Modified By michael  on 9/11/2009 12:10:14 PM

Marien,

I actually do a distinct select of DocumentType form the Documents list and populate the parameter with the results.

The user can select from this list. And it contains <null> and <space>

so:

1. Yes there are

2. No error, just nothing is found.

3. Lookup ID, hmmm, this has no significance to the user, but perhaps I don't understand.

Is it right I can't use parameters in the sqlQuery ?

When I am in the office next tuesday, I shal send more code...

New Post
 9/11/2009 1:23 PM
 

Hi michael,

Just to be sure that you can use the Lookup ID, can you have several DocumentType with the same value but not the same ID?

If not, in order to use the Lookup ID, while keeping the Lookup value displayed, you would do something similar to :

  1. Update your dataset which returns the distinct DocumentType from the Documents list to retrieve the ID and the Title instead of just retrieving the Title
  2. Update your parameter properties to something similar to:

    The users would still see the Document Types, but the parameter values would be the Lookup IDs
  3. Update your second dataset query and add LookupId="true" in the FieldRef element:
    <Eq>
      <FieldRef Name="DocumentType" LookupId="true" />
      <Value Type="Lookup">@rptDocumentType!</Value>
      <IfNot>All</IfNot>
    </Eq>

But, if you can have several DocumentTypes with the same value and not the same ID, I would appreciate some more data so I can reproduce this issue. If you could send us your lists to our support address (available in the last page of the documentation), I would be able to further help you.

Regards,
Marien Monnier
Enesys

New Post
 9/15/2009 9:26 AM
 
 Modified By michael  on 9/15/2009 8:27:52 AM

Well, I am afraid you do not understand.

If DocumentType = <null> then the Id = <null> too, meaning that the user has not selected a DocumentType when creating the document.

So, this does not help

So then problem stays:

         <Eq>
            <FieldRef Name="DocumentType" />
            <Value Type="Lookup">@rptDocumentType!</Value>
            <IfNot>All</IfNot>
          </Eq>

If  @rptDocumentType! = <null> the condition fails....

 

New Post
 9/15/2009 11:01 AM
 

Hi michael,

Indeed, I thought you had a DocumentType which value is null in your document types. It would still have an ID in this case, so my answer does not apply for your case.

I was able to do something using an sqlQuery statement, but you will loose a little bit on performances.

Remove your Eq filter from your Caml Query and add an sqlQuery similar to this one:

<sqlQuery tableName="res">
SELECT * FROM Documents
WHERE (DocumentType = @param! OR @param! = "All")
OR (@param! IS NULL AND DocumentType IS NULL)
</sqlQuery>

The first condition is to do the IfNot behavior, and the second one is to take care of the Null DocumentType.

I hope this help this time.

Regards,
Marien Monnier
Enesys

New Post
 9/15/2009 3:25 PM
 

Ok, this works

Thank you very much !

Previous Previous
 
Next Next
ForumForumEnesys RS Data ...Enesys RS Data ...Support - RS Da...Support - RS Da...Use of report parametersUse of report parameters

 
You need to login for posting to the forums.
If you don't have a login, click here to register.
 
Copyright 2010 Enesys - All rights reserved Terms Of UsePrivacy Statement