Showing posts with label wrong. Show all posts
Showing posts with label wrong. Show all posts

Friday, February 24, 2012

Custom Code error with VB function

Hello, I am about out of hair from pulling it out. If someone could please show me what I'm doing wrong I would really appreciate it. I have this function for a SSRS 2005 report:

Public Function funAdditions(pFields As Fields) As Double
if pFields !FA00902_AMOUNT.Value > 0 and
pFields !FA00902_TRANSACCTTYPE.Value = 3 and
pFields !FA00902_DEPRTODATE.Value > Parameters!BeginDate.Value and
pFields !FA00902_DEPRTODATE.Value <= Parameters!CutOffDate.Value and NOT
instr(pFields !FA00902_SOURCDOC.Value, "FACHG")=1
then return pFields !FA00902_AMOUNT.Value
end
else if pFields !FA00902_TRANSACCTTYPE.Value = 3 and
pFields !FA00902_DEPRTODATE.Value > Parameters!BeginDate.Value and
pFields !FA00902_DEPRTODATE.Value <= Parameters!CutOffDate.Value and
instr(pFields !FA00902_SOURCDOC.Value, "FACHG")=1
then return pFields !FA00902_AMOUNT.Value
end
End Function

...and after much research cannot figure out the solution to this error:

[rsCompilerErrorInCode] There is an error on line 1 of custom code: [BC30201] Expression expected.

I'm new to SSRS so is there a syntax error I'm missing?

Thanks in advance,

Buster

Just a thought, and it may be that your code has been munged by pasting it into here, but you seem to have your code lines split over several physical lines, to do that in VB and VBScript you need to use the line continuation character, which is an underscore. So your first line should look something like this:

Public Function funAdditions(pFields As Fields) As Double
if pFields !FA00902_AMOUNT.Value > 0 and _
pFields !FA00902_TRANSACCTTYPE.Value = 3 and _
pFields !FA00902_DEPRTODATE.Value > Parameters!BeginDate.Value and _
pFields !FA00902_DEPRTODATE.Value <= Parameters!CutOffDate.Value and NOT _
instr(pFields !FA00902_SOURCDOC.Value, "FACHG")=1 then

return pFields !FA00902_AMOUNT.Value

...etc...

Sometimes it can be handy to fire up the macro code editor that you get with Excel and Word and do your code in that to make sure it is syntactically correct.

Sunday, February 19, 2012

Custom Authentication and Report Builder

Report Builder doesn't play to well with Custom authentication does it?
If i'm wrong let me know, otherwise, time to start getting creative again.Welcome to the MSDN newsgroup Chris,
As for the custom authentications like Forms Authenticaiton, it require the
client-side application interactively provide the username/password
credentials, therefore when report server is configured to use forms
authentication, we can access the reports or other resources through
browser. For those client application which programmatically access the
reports, such as the ReportBuilder tool, it will fail to provide user
credential interactively, so this is one of the limitation when using forms
authentication currenlty.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Tuesday, February 14, 2012

Cursors vs. Queries

One query statement is much faster than the equivalent
Cursor query.
If I am correct (and please tell me if I'm wrong) its
about 20 times faster than putting the same statement in a
cursor.
However cursors are more controllable, and better for
error checking and error recovery.
My rule of thumb.
If you can get a way with using a query then use it,
however you will need cursors to do anything complex.
J
quote:

>--Original Message--
>Can someone give me an example of when I would use a

cursor instead of a query
quote:

>.
>
> however you will need cursors to do anything complex.
Could you give an example of a problem that is too complex for a query
solution?
David Portas
--
Please reply only to the newsgroup
--