how to put more than 1 record in an oracle apex form? - forms

I have a problem with oracle apex forms.
The problem is that I want to add more than 1 record at the same time in 1 form. I have already read that the best way to do that is to use an csv file but then there is no tutorial to do that.

Oracle is a database, and combining files with databases is always tricky and not extensively supported for obvious reasons. Storing files and presenting them for download is one thing. Getting an Oracle database to open a file and reading and processing the contents is another. It sure it possible, but especially combining this with an Apex application I think you are going to run into a lot of challenges such as security restrictions.
However, stepping away from files does not necessarily mean stepping away from CSV. You could simply offer a large text input on your page in which a user can copy-paste a large CSV string. This can then be submitted and processed by the database. To do this you would probably need to create a process that gets fired after you submit the page. From this process you can parse the CSV data and insert multiple rows in a table. The same can be done for things like XML or JSON.
However, who is generating this CSV? Requiring a user to construct CSV is not very user-friendly. It can be complicated and error prone. If the CSV is generated by another application, isn't there a way to circumvent Apex and pass the CSV to the database directly?
If a single text-based data carrier is not required, which I doubt reading your descriptions, why not simply keep your form but allow the user to submit multiple forms? Would if be sufficient to insert one record per submit, and later using a batch to query these records and start formatting one at a time?
If you simply want the user to be able to enter multiple machines without having to submit the page for each machine, this is also possible, but you will have to leave some standard Apex functionality behind and implement some more custom javascript and PL/SQL functionality. Apex only allows a static amount of page items, which needs to be defined design time. So if you want to dynamically add fields such as text boxes and select lists to your page, you will have to resort to javascript. You could start by defining a region which renders one row of input fields at page load, and create a link under it saying 'add another row', which will render a new row of input fields under the existing one, and repeat this as many times as the user needs to.
That takes care of the UI. Now when the user has entered all the data he wants, we need to submit all this data and get it into the database. So yes, at this point we would probably have to get all this data from the input fields and turn it into one single string. This would all have to be done client side in your javascript code. You can then use the Apex page item API to assign this generated string to a single page item, using the $x(...) or $v(...) functions. Then submit the page, at which point the page processes will be fired. You then define a page process which will parse the data in your page item, and use that data to insert multiple rows in the database.

Related

Out result directly onto current screen field without C# etc

Is there a way to output my SQL result directly to where screen cursor is currently. Example: If i execute "select 1" I want the result 1 to immediately populate where my cursor is (like a form fill). So if i place my cursor in an open notepad file, execute the query, it populates the 1 directly in as though "typed" in. I need to achieves this all through SQL query without C# or others.
Pretty sure many won't approve (if it's even possible) but i do have my reason for wanting to achieve this.
In short: no.
Long: I am sure you can't do this without using other programming languages.
The databases' purpose is to help application developers with storing and effectively retrieving data. So, it's kind of "utility for developers" which doesn't do anything useful without a separate (let's call it "front-end") program that inserts into and requests data from there.
My guess is you need a standalone program that wait for special key combination, asks db for data retrieval, detects active window and the element, and pastes data in there

Best practices for editing data using forms in ms-access

So I've started learning access due to necessity, as the person who was in charge of it passed way and someone had to keep it going.
I noticed a very bad (at least IMO) behavior in all databases he created: Every single form was bound directly to a table or saved query. This way, if the user opened a form, he had to complete all the steps he was supposed to do, because if he closed the form mid process (or the computer froze, or anything of the sort), the actual data would be compromised as it would be half complete. This often times broke everything in the process chain, rendering sub-sequential steps impossible to be performed and forced me to correct data manually directly in the tables.
As I've start upgrading his stuff and developing my own, I've been trying to learn ways to allow the data to be edited in the form only, making it possible to cancel the process anytime or save the changes all at once in the end.
If the editions were simple, I discovered that I could create a recordset, copy relevant data to unbound fields in the form and, in the end, if the user chose to, copy the data from the form fields back to the recordset.
Other times more complex solutions were required, as I would need to edit several pieces of data at once in continuous forms, "save" them, run more code, maybe add fields to hold the information originated from that processing and so on. I then learned about using temporary tables, but did not like it, since it tended to bloat the db. I even went on to creating temporary databases during code execution that would host the temporary tables and be destroyed in the end, but that added too much unnecessary complexity.
Nowadays I'm using disconnected ADO recordsets to hold the temporary data and fields. It works but has its limitations.
So I'm wondering, what is the best way you - much more experienced than me - guys use to approach this kind of scenario? Is using in memory ADO recordsets really the best way around?
I think you are mixing two things that a form does that have completely different requirements. Editing existing records (and bound forms are great for that) and creating new records (where using a straight bound form can result in creating incomplete records). The way to approach it depends on many things but mainly to how much data is necessary for a new record to be considered "complete".
I usually do one of the following things:
Create an unbound popup modal form for adding new records where only the necessary fields are present. Once complete it loads the new record to the main form for further editing.
Use the above method except the form is not a popup one but a set of unbound fields in the footer or header of the main form.
Let the user create new records but bind validation on the OnClose (and/or other appropriate to your situation) event of the form that deletes the half-filled record if it does not validate.
Let users create new records in the bound form but have a 'cleanup' routine called either on a schedule or based on user actions.
Ultimately if your business process requires the majority of fields to be manually added/edited every time a new record is added or edited, you are better off using an unbound form.
This way, if the user opened a form, he had to complete all the steps
he was supposed to do, because if he closed the form mid process (or
the computer froze, or anything of the sort), the actual data would be
compromised as it would be half complete
No, if the computer freezes, then no data is saved to the table. This is the same if you used a disconnected reocrdset and a un-bound form.
If you use the before update event in the form that has some verification code and does a simple cancel = true, then the forms data is not saved nor is the table updated. Again, if you used a dis-connected record set and the user closes the form, you have to test the data – and again you can either choose to write out the data or not – this effect is ZERO difference from using a bound form to a table or a disconnected form.
If the editions were simple, I discovered that I could create a
recordset, copy relevant data to unbound fields in the form and, in
the end, if the user chose to, copy the data from the form fields back
to the recordset.
No you don’t need to do the above. The above achieves nothing and only racks up additional development hours and increases cost of the application. In near all cases in-bound forms increase development costs over that of a simple form bound to a table. So the original developer had the correct idea. You can control the update of the underlying table in near all cases to achieve the required verification. Forms only save and write the data out if the developer allows as such.
So Access forms when bound no more or less write incomplete data out to a table if you place verification code in the forms before update event. A half-filled bound form, or a half filled un-bound form with dis-connected reocrdset BOTH will not write their data if the computer freezes.
And BOTH types of forms will not write out data to table until such time your verification code has completed.
Access is not designed for un-bound forms, and tools like vb.net, or even VB6 had a whole bunch of cool wizards and support for un-bound forms. In access, we don't have those wizards. And when you use UN-bound forms then you loose tons of form events. You in effect get the worst of both worlds, since you lose use of form events and have no wizards or support for un-bound. Even just the several delete record events we have are rather amazing.
You lose use of me.dirty, on-insert, me.newReocrd, forms after update events - the list of features you toss out and lose is huge. And if you want a button to write data to the table (such as a save button on the form), then just go:
If me.Dirty = True then
me.Dirty = False ' this forces your verification code to run
End if
There are FEW use cases in which in-bound forms will benefit you, but they will cost you rather much in terms of development times.

Is it possible to change the way a form loads with different data fields and values (Acces 2010)

I have Access 2010. I was wondering if there is a way to get the form to load different for every selection.
Example
Item A has 10 Rows and 6 columns of filled in data
Item B has 3 Rows and 2 Columns of filled in data
Both are from the same table.
Is there a way when a certain item is selected from a drop down menu to load, without having multiple forms, only the filled in data? Output would resemble Excel format.
Thank you in advance for any help.
Quick Answer (TL;DR)
Creating dynamically-generated form structure in MSFT Access can be done with sub-forms.
Detailed Answer
Context
MSFT Access
Creating forms
Problem
Scenario: Developer wishes to create context-specific form structure that depends on the query output.
Solution
Create one or more sub-form with attached VBA that changes dependent on the query ouput.
Connect the subform(s) to the primary form and load as needed depending on the context.
See also
https://stackoverflow.com/questions/tagged/ms-access+forms+vba
https://duckduckgo.com/?q=msft+access+dynamic+subform
How to dynamically load, access and unload subforms in microsoft access

Visio 2013: How to trigger a change in databinding of all shapes

I have a nice process overview for our ordering process in Visio. I have an external data source (SQL Server), which works fine. Every record in my data source represents one ordering process. Currently all my shapes of the process are linked to the first record of the data source.
Now I want to add a dynamic behavior. What I want to achieve is this:
A user provides the order reference in a textbox (order reference is a column in the data source)
Afterwards the user clicks a button
After the button click, the process is updated and all shapes are now linked to the external data source record, that matches the provided order reference
So in short: the user should be able to select which process that needs to be visualized.
I assume that this is common functionality, but I don't see how I can deal with this requirement. I've searched already some days on this issue, but without any success.
Can you help me with this issue?
Thanks a lot!
Problem solved :-)
Some old school VBA was required. Using the DataRecordSet object did the trick. It contains a method GetDataRowIDs that you can use to query the external dataset. Once you have the record to visualize, it's just a matter of dynamically updating the shapes with the correct record. Use macro recording to see how to do this.
MSDN: http://msdn.microsoft.com/en-us/library/office/ms195694(v=office.12).aspx

2d form for data entry in Access

I'm using Access 2010 and I would like to create a form where useres can enter data much like they can in an Excel format. The users need to enter a date when a step is complete for a specific unit.
In Excel the units run aross the top row, the steps run down the left column. In the cell where the unit and step meet, you put a date when it is done. In Access it is much harder to create a form that looks like this (at least it has been for me so far). I tried to use a crosstab query, but you cannot enter information into a crosstab query. I can do a massive form listing every combination of units and steps, but there are over 50 units and each one has 63 steps. I don't want users to have to look through a form with over 3,000 lines in it just to enter a date completed.
This definitely feels like something we should be using a database for instead of an Excel spreadsheet. I have the format for the back end tables to hold the data. My problem is how to create a form that is easy for the user to enter the dates.
I think you have three options. First, you could build the form from scratch, which you've already admitted would suck. And it would take a lot of VBA to get the data in the right place. Second, you could automate Excel - it's the same as the first method but you don't have to build the form. You would populate an Excel spreadsheet and write the changes back to the database. This is not a trivial task and I don't recommend it.
The third option is to throw away the idea that you want to do this in a grid. You've probably been doing it in Excel and to the extent that you replicate that, your users will be happy and comfortable. Moving to a database gives you benefits, but there are costs. This is one of the costs.
So create a form with a dropdown containing all of the units. When a unit is selected, populate a subform (datasheet view) listing all of the procedures and dates. The user can then select the unit, and fill in the date next to whichever procedures he wants. Then he can select another unit and do the same thing. If you set it up right, your data will flow to the tables automatically and you'll get all the benefits of data validation, input masks, relationships, and whatever else you're using at the table level.
I know that's not what you were looking for, but I think it's the best way forward.