This is a continuation of the "Array out of Bounds" topic that I have worked with in the past couple of days. I am through with topic so I started a new one now.
With the help of several posts, I have gone from scratch on my form to the point of designing a UI Dialog box that displays well names from a table called MMSPRP that is contained within a set called MMS in a database. Choosing a well name from the table MMSPRP and clicking the "ok" button on the UI dialog box was working as of yesterday.
However, there was still much work to be done on the form, and I have been able to somewhat get my next improvement on the form to work.
Yesterday, I had character fields on the form instead of date fields which basically referenced a year and month in the format "CCYYMM". This works fine if you know what you are doing when you select a beginning and ending period.
To make it easier for the user though, I broke the field Beg_month into two components, begmo and endmo, and replaced Beg_month on the form with these two fields. I set up drop down boxes for each with the month always a 2 character allowed response. I did the exact same thing for the field end_month by breaking it into endmo and endyr.
Then, I set up beg_month and end_month as form calculated fields. As an example; Beg_month was assigned the expression: var->begyr+begmo which produces the character result "200208" if the values in begmo and begyr respectively are "08" and "2002". It is necessary to get these types of formats since this is the way the records in the database are set out.
One of my questions is concerning how to not allow the user to type in an erroneous value for lets say the begmo drop down box. If I type in "8" instead of selecting "08" right now, the drop down lets me do that. But that would cause a problem for record selection for the report I am wanting to print.
Also, my other question has to do with passing the beg_month and end_month variables to my report. When I had trouble getting my report to pull in these global variables on my form, I used another method at the same time to see if this would pass the calculated values in beg_month and end_month to my report. In the dropdown4 object (which is my end year value contained in endyr) under actions, I did the following for the Ondepart Event; end_month=endyr+endmo. For the dropdown2 object (which is my begyr value) under actions, I did the following for the Ondepart Event; Beg_month=begyr+begmo. So, I'm not sure yet if the calculated fields on the forms are what is working or if the Ondepart Event thing I just typed out is what is causing the global variables beg_month and end_month to get passed to the report.
My report called "Report by Well Name" has the following for its filter expression under the records tab of the detail properties.
New_Name=Var->Namex.AND.S_Mnth>=Var->Beg_Month.AND.S_MnthEnd_Month
Here is my OnDepart action for the "wellname" field on my form which basically transforms its value to the variable "namex" in this script.
''XBasic
dim welllisting(1024) as c
dim inputf as p
dim name as c
dim global wellname as c
dim global namex as c
dim i as n
inputf=table.open("mmsprp",file_ro_shared)
inputf.index_primary_put("Property")
i=1
inputf.fetch_first()
while .not. inputf.fetch_eof()
welllisting(i)=inputf.new_prprty
inputf.fetch_next()
i=i+1
end while
name=ui_get_list_array("Select your well",1,"welllisting")
namex=substr(name,1,25)
inputf.close()
Report.Preview("Report by Well Name@d:\myfiles\a5v4data\mms\mmshist.dbf")
end
Once I fully understand what is going on here, then I will be doing a separate UI box for the form that will allow the user to specify a property code.
Each well can have the product "Oil" or "Gas", so basically each well is showing up twice in my UI box right now. I am not concerned yet about tackling this part of the product code UI box. But, I would like it at this point if the well name in the UI box only displayed once, rather than however many times it actually is in that field.
I hope this lengthy explanation makes sense. Please let me know if you need further clarification to answer my questions.
Thanks,
Bruce
With the help of several posts, I have gone from scratch on my form to the point of designing a UI Dialog box that displays well names from a table called MMSPRP that is contained within a set called MMS in a database. Choosing a well name from the table MMSPRP and clicking the "ok" button on the UI dialog box was working as of yesterday.
However, there was still much work to be done on the form, and I have been able to somewhat get my next improvement on the form to work.
Yesterday, I had character fields on the form instead of date fields which basically referenced a year and month in the format "CCYYMM". This works fine if you know what you are doing when you select a beginning and ending period.
To make it easier for the user though, I broke the field Beg_month into two components, begmo and endmo, and replaced Beg_month on the form with these two fields. I set up drop down boxes for each with the month always a 2 character allowed response. I did the exact same thing for the field end_month by breaking it into endmo and endyr.
Then, I set up beg_month and end_month as form calculated fields. As an example; Beg_month was assigned the expression: var->begyr+begmo which produces the character result "200208" if the values in begmo and begyr respectively are "08" and "2002". It is necessary to get these types of formats since this is the way the records in the database are set out.
One of my questions is concerning how to not allow the user to type in an erroneous value for lets say the begmo drop down box. If I type in "8" instead of selecting "08" right now, the drop down lets me do that. But that would cause a problem for record selection for the report I am wanting to print.
Also, my other question has to do with passing the beg_month and end_month variables to my report. When I had trouble getting my report to pull in these global variables on my form, I used another method at the same time to see if this would pass the calculated values in beg_month and end_month to my report. In the dropdown4 object (which is my end year value contained in endyr) under actions, I did the following for the Ondepart Event; end_month=endyr+endmo. For the dropdown2 object (which is my begyr value) under actions, I did the following for the Ondepart Event; Beg_month=begyr+begmo. So, I'm not sure yet if the calculated fields on the forms are what is working or if the Ondepart Event thing I just typed out is what is causing the global variables beg_month and end_month to get passed to the report.
My report called "Report by Well Name" has the following for its filter expression under the records tab of the detail properties.
New_Name=Var->Namex.AND.S_Mnth>=Var->Beg_Month.AND.S_MnthEnd_Month
Here is my OnDepart action for the "wellname" field on my form which basically transforms its value to the variable "namex" in this script.
''XBasic
dim welllisting(1024) as c
dim inputf as p
dim name as c
dim global wellname as c
dim global namex as c
dim i as n
inputf=table.open("mmsprp",file_ro_shared)
inputf.index_primary_put("Property")
i=1
inputf.fetch_first()
while .not. inputf.fetch_eof()
welllisting(i)=inputf.new_prprty
inputf.fetch_next()
i=i+1
end while
name=ui_get_list_array("Select your well",1,"welllisting")
namex=substr(name,1,25)
inputf.close()
Report.Preview("Report by Well Name@d:\myfiles\a5v4data\mms\mmshist.dbf")
end
Once I fully understand what is going on here, then I will be doing a separate UI box for the form that will allow the user to specify a property code.
Each well can have the product "Oil" or "Gas", so basically each well is showing up twice in my UI box right now. I am not concerned yet about tackling this part of the product code UI box. But, I would like it at this point if the well name in the UI box only displayed once, rather than however many times it actually is in that field.
I hope this lengthy explanation makes sense. Please let me know if you need further clarification to answer my questions.
Thanks,
Bruce
Comment