INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Overiding ObtainSelectStatement

Overiding ObtainSelectStatement

(OP)
I am using erdpro v8, and Maximo 6.2.2 on a sql db

I need a report parameter which allows the user to optionally specify a parameter limiting the output, where if the user leaves the non-required itemnu field blank all the item numbers are returned. Here's my sql datasource code before.


SELECT  siteid,itemnum,storeloc,description,transact,transdate,
quantity,curbal,physcnt,enteredby,memo,issuedto, wonum

FROM [ASD_D_INVTRANS]

where
and itemnum = :itemnu
ORDER BY transdate DESC;

'note: the above sql code requires a response from the user where the user must input a value as itemnu.

Here's my sql in my datasource after:

SELECT  siteid,itemnum,storeloc,description,transact,transdate,
quantity,curbal,physcnt,enteredby,memo,issuedto, wonum

FROM [ASD_D_INVTRANS]

where
/*****and itemnum = :itemnu ******/
ORDER BY transdate DESC;

'To achieve my goal, I will remove the parameter :itemnu from the sql code (as shown above) and override the select statement (datasource's obtainselectstatement method as shown below). This should then make the parameter optionable.


Here is what my datasource's obtainselectstate method looks like:

Function ObtainSelectStatement( ) As String
     
     If Not (itemnu = "") then
     where = where & " AND " & parseParam2(itemnu, "ASD_D_INVTRANS.itemnum")
       End If
 
     Where = Where & "AND 1=1"
     ObtainSelectStatement = Super::ObtainSelectStatement( )
     SelectStatement = StrSubst (SelectStatement, "1=1", where)
  
End Function

I added itemnu as a parameter by going to tools parameter in erdpro and created a string variable called itemnu. Then I edited the obtainselectstatement datasource method as shown above.

This did not work as I had hoped it would. The obtain select statement is not processing correctly when the user inputs a specific item number; instead, it works as if there is no restriction and returns all the item numbers no matter what the user inputs into the itemnu parameter field. What should I do to make this work correctly.







 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close