@Prompt or UserResponse

Can anyone help. I want use a ‘User’ Input in a calculation. For example the user will enter 2 dates. These 2 user inputs will be used in a “IF statement”.

How can I store a user input so that I am able to use it in equation or have the ability to manipulate it. :frowning:

many thanks for any help
Zahed


Sims786 (BOB member since 2006-04-04)

Hi,

Use UserResponse() function to get a value entered by a user in a prompt.

You can also create a report level variable that will use UserResponse() function. Then you use the new variable instead of the function, if it’s more convenient.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

I add a variable in at the Report level

eg. UserReponse (“Enter a date”) within a Dimension Object. If I bring this object into the report should I expect a User prompt to appear. To be honest unsure how to configure the UserReponse function.

thanks
Zahed


Sims786 (BOB member since 2006-04-04)

Hi Zahed,

UserResponse() function is used for getting a value that a user entered in a prompt. It’s not used to create the prompt.

I think I answered the question how to create the prompt in your other topic here:


Marek Chladny :slovakia: (BOB member since 2003-11-27)

@Prompt(’message’,'type’,[lov],mono/multi,free/constrained/primary_key,per
sistent/not_persistent, [{'default value':'default key'[,'default value':'default
key',...]})

This is the prompt syntax.

Use prompt to give user date option.


Rakesh_K :india: (BOB member since 2007-12-11)

Hi

Make it simple, In menu bar-- Insert–>Special Field–>Query Prompt and then select which prompt value you needs to display on report. If you need a variable to be created, copy the formula from the inserted cell and create variable .

Regards
Siva.M


looksmee :uk: (BOB member since 2006-02-08)

Sorry mate…No more shouting

Its OK working now. Only problem now is it seems, that when I use the UserResponse function to capture the User’s date Input , it converts this to a “Detail” object. I unable to compare/calculate this with a DIMENSION (date) . How do I convert the “Detail” date object into a Dimension date or another method so I can do a date calculation on the detail object.

Many thanks
Zahed :slight_smile:


Sims786 (BOB member since 2006-04-04)

UserResponse() will return a string value, convert that string into date format and then compare.


Rakesh_K :india: (BOB member since 2007-12-11)

Hi,

If I remember correctly, result of UserResponse() is always a detail object. But it should not be a problem. You should be able to compare it with a dimension object without a problem.

The problem that I see is that you want to compare the result of UserResponse() with a date. But the function gives you a string. So first you need to convert the string to a date (using ToDate() function) and then compare it with a dimension object of a date type.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

I used the following…When I dragged it into the report I got #ERROR

=ToDate(<User_date1>,“dd/mm/yy”)

where User_date1 (Detail) object has the following

=UserResponse(“Query 1 with DTSS_Cars” ,“Enter a Date1”)

Help would grateful

Many thanks to all so far
Zahed :x


Sims786 (BOB member since 2006-04-04)

Hi,

What is the exact result returned by this formula?

Thanks.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

The value returned is 01/06/2008.

Tried carrying out a simple calc with a date Dimension but get Incorret data type (DMB000)

eg. Date (Dimension)=Date1 (Detail)

many thanks
Zahed :smiley:


Sims786 (BOB member since 2006-04-04)

Is this formula working?

=ToDate(UserResponse("Query 1 with DTSS_Cars" ,"Enter a Date1") ,"dd/mm/yyyy")

Marek Chladny :slovakia: (BOB member since 2003-11-27)

Formula is accepted, but when I drag the dimension to report i get #ERROR

Thanks
Zahed


Sims786 (BOB member since 2006-04-04)

sorry It works

I used “dd/mm/yy” instead of “dd/mm/yyyy” :smiley:

Great

Again many thanks
Zahed


Sims786 (BOB member since 2006-04-04)

Yeah, be always careful about the string format used in the ToDate() and FormatDate() functions. :yesnod:


Marek Chladny :slovakia: (BOB member since 2003-11-27)