# Miscellaneous > Database Programming >  default values during add

## Jim Santarius

I am putting together an application where I isolate the recordset with a where clause in the dbSQL property (I have a where clause with a field called category set to a value).  How can I get dbPro to set the default value for my category field to the current value when I enter Add mode?  Since the user is working in that view of the data I don`t want to require them to enter it.  What I need is the ability to set the default value during add mode to a session variable.

Jim

----------


## Frank

Jim,
There are a couple of new features in the coming release that might help you to resolve the problem. One of them is the export of the button state before and after the click. That means when you click the "Add" button, a variable in the URL called aspDBClick=add will be available to you via request("aspDBClick") or request.form("aspDBClick") to intercept and process anything before you pass the control to aspDB. Here you can "change" the properties like dbSQL, DSN .. etc. Also, after the button is clicked and the screen is displayed, a new property called dbLastScreen will contain the name of the last screen displayed. Between the two, you should be able to have full control. If it doesn`t work out, get back with the problem and we`ll solve it !!


Frank



On 9/28/98 4:57:05 PM, Jim Santarius wrote: 
> I am putting together an application where I isolate the recordset with a 
> where clause in the dbSQL property (I have a where clause with a field 
> called category set to a value).  How can I get dbPro to set the default 
> value for my category field to the current value when I enter Add mode?  
> Since the user is working in that view of the data I don`t want to require 
> them to enter it.  What I need is the ability to set the default value 
> during add mode to a session variable.

Jim

----------


## Jim Santarius

Frank,

Well I`m not sure I follow what your saying until I see it in action.  What I was thinking was more along the lines of a new property like dbEditDefaultFlds perhaps using pairs such as in dbNameMap where it might look like this:

dbEditDefaultFlds="field,default;field,default"

Since the edit form (in add mode) is using text inputs couldn`t you just set the value of the tag to the default as indicated?  And, to make it even better yet if you were using dbEditDropFlds, set the selected value in the dropdown to the default.  I don`t ask for alot do I :-)!

Actually I can almost get what I want by using dbEditDropFlds setting a user defined list with one value from my session variable.  The only problem with that approach is that the list has no selected value so, though the list has only one item in it I still have to select it. Now if the list defaulted to selecting the first value if there were only one to select...

Thanks again,

Jim
On 9/29/98 11:58:34 AM, Frank wrote: 
> Jim,
There are a couple of new features in the coming release that might 
> help you to resolve the problem. One of them is the export of the button 
> state before and after the click. That means when you click the "Add" 
> button, a variable in the URL called aspDBClick=add will be available to 
> you via request("aspDBClick") or request.form("aspDBClick") to intercept 
> and process anything before you pass the control to aspDB. Here you can 
> "change" the properties like dbSQL, DSN .. etc. Also, after the button is 
> clicked and the screen is displayed, a new property called dbLastScreen 
> will contain the name of the last screen displayed. Between the two, you 
> should be able to have full control. If it doesn`t work out, get back with 
> the problem and we`ll solve it !!


Frank



On 9/28/98 4:57:05 PM, 
> Jim Santarius wrote: 
> I am putting together an application where I 
> isolate the recordset with a 
> where clause in the dbSQL property (I have 
> a where clause with a field 
> called category set to a value).  How can I 
> get dbPro to set the default 
> value for my category field to the current 
> value when I enter Add mode?  
> Since the user is working in that view of 
> the data I don`t want to require 
> them to enter it.  What I need is the 
> ability to set the default value 
> during add mode to a session 
> variable.

Jim

----------


## Frank

Jim,
The question of "default" has been considered. The fact that SQL has a DEFAULT keyword and I have to figuer out how to implement that to fit both ACCESS and SQL. It`ll be there one way or the other.

Frank


On 9/29/98 8:31:52 PM, Jim Santarius wrote: 
> Frank,

Well I`m not sure I follow what your saying until I see it in 
> action.  What I was thinking was more along the lines of a new property 
> like dbEditDefaultFlds perhaps using pairs such as in dbNameMap where it 
> might look like 
> this:

dbEditDefaultFlds="field,default;field,default"

Since the edit 
> form (in add mode) is using text inputs couldn`t you just set the value of 
> the tag to the default as indicated?  And, to make it even better yet if 
> you were using dbEditDropFlds, set the selected value in the dropdown to 
> the default.  I don`t ask for alot do I :-)!

Actually I can almost get 
> what I want by using dbEditDropFlds setting a user defined list with one 
> value from my session variable.  The only problem with that approach is 
> that the list has no selected value so, though the list has only one item 
> in it I still have to select it. Now if the list defaulted to selecting the 
> first value if there were only one to select...

Thanks again,

Jim
On 
> 9/29/98 11:58:34 AM, Frank wrote: 
> Jim,
There are a couple of new 
> features in the coming release that might 
> help you to resolve the 
> problem. One of them is the export of the button 
> state before and after 
> the click. That means when you click the "Add" 
> button, a variable in 
> the URL called aspDBClick=add will be available to 
> you via 
> request("aspDBClick") or request.form("aspDBClick") to intercept 
> and 
> process anything before you pass the control to aspDB. Here you can 
> 
> "change" the properties like dbSQL, DSN .. etc. Also, after the button is 
> 
> clicked and the screen is displayed, a new property called dbLastScreen 
> 
> will contain the name of the last screen displayed. Between the two, 
> you 
> should be able to have full control. If it doesn`t work out, get 
> back with 
> the problem and we`ll solve it !!


Frank



On 
> 9/28/98 4:57:05 PM, 
> Jim Santarius wrote: 
> I am putting together an 
> application where I 
> isolate the recordset with a 
> where clause in 
> the dbSQL property (I have 
> a where clause with a field 
> called 
> category set to a value).  How can I 
> get dbPro to set the default 
> 
> value for my category field to the current 
> value when I enter Add mode? 
>  
> Since the user is working in that view of 
> the data I don`t want to 
> require 
> them to enter it.  What I need is the 
> ability to set the 
> default value 
> during add mode to a session 
> variable.

Jim

----------


## Frank

Jim,
This feature has been implemented. Except a few syntax difference, it has all that you mentioned and more like default value of now() will be converted to mm/dd/yy hh:mm:ss etc. and workd for "Add" and "Filter". Send to quality control to be tested. Watch for it in the coming releases.

Thanks for the suggestion,


Frank

On 9/29/98 8:31:52 PM, Jim Santarius wrote: 
> Frank,

Well I`m not sure I follow what your saying until I see it in 
> action.  What I was thinking was more along the lines of a new property 
> like dbEditDefaultFlds perhaps using pairs such as in dbNameMap where it 
> might look like 
> this:

dbEditDefaultFlds="field,default;field,default"

Since the edit 
> form (in add mode) is using text inputs couldn`t you just set the value of 
> the tag to the default as indicated?  And, to make it even better yet if 
> you were using dbEditDropFlds, set the selected value in the dropdown to 
> the default.  I don`t ask for alot do I :-)!

Actually I can almost get 
> what I want by using dbEditDropFlds setting a user defined list with one 
> value from my session variable.  The only problem with that approach is 
> that the list has no selected value so, though the list has only one item 
> in it I still have to select it. Now if the list defaulted to selecting the 
> first value if there were only one to select...

Thanks again,

Jim
On 
> 9/29/98 11:58:34 AM, Frank wrote: 
> Jim,
There are a couple of new 
> features in the coming release that might 
> help you to resolve the 
> problem. One of them is the export of the button 
> state before and after 
> the click. That means when you click the "Add" 
> button, a variable in 
> the URL called aspDBClick=add will be available to 
> you via 
> request("aspDBClick") or request.form("aspDBClick") to intercept 
> and 
> process anything before you pass the control to aspDB. Here you can 
> 
> "change" the properties like dbSQL, DSN .. etc. Also, after the button is 
> 
> clicked and the screen is displayed, a new property called dbLastScreen 
> 
> will contain the name of the last screen displayed. Between the two, 
> you 
> should be able to have full control. If it doesn`t work out, get 
> back with 
> the problem and we`ll solve it !!


Frank



On 
> 9/28/98 4:57:05 PM, 
> Jim Santarius wrote: 
> I am putting together an 
> application where I 
> isolate the recordset with a 
> where clause in 
> the dbSQL property (I have 
> a where clause with a field 
> called 
> category set to a value).  How can I 
> get dbPro to set the default 
> 
> value for my category field to the current 
> value when I enter Add mode? 
>  
> Since the user is working in that view of 
> the data I don`t want to 
> require 
> them to enter it.  What I need is the 
> ability to set the 
> default value 
> during add mode to a session 
> variable.

Jim

----------

