PL/SQL and Oracle Forms Builder - plsql

So I need to put this project together for school, but I'm ONLY allowed to use oracle forms builder.
I'm trying to do a simple query and assign values to the form objects based on what I get from the query, but my form items are coming up as undeclared. Does anyone know how I can modify form attributes like this? This user interface on this program is awful, so doing it through the wizards is something I'd really like to avoid if I can just make things happen in PL/SQL.
Here's what I have:
Still trying to find a working solution.
I've modified my code a bit:
DECLARE
pmrn patient.p_mrn%TYPE;
var_ptuple patient%ROWTYPE;
BEGIN
pmrn := NAME_IN('MRN_FIELD');
SELECT * INTO var_ptuple from patient WHERE patient.p_mrn = pmrn;
:PATIENT_BLOCK.FNAME := var_ptuple.p_fname;
:PATIENT_BLOCK.LNAME := var_ptuple.p_lname;
END;
Using the where on the data block doesn't really suit these purposes because I would like to retrieve the data based on the user input. Ie. the user needs to input the correct user ID to see their records.

Form items can be referred to as bind variables in Forms PL/SQL, e.g.
pmrn := :PATIENT_BLOCK.MRN_FIELD;
:PATIENT_BLOCK.FNAME := var_ptuple.p_fname;
etc.
Be aware, however, that you most probably don't need to write all this code. Just set the block source to be the table and execute a query on it - Forms will take care of loading the records for you.

Related

APEX 4.1 SQL Query using a page item to define FROM

I am trying to utilize a single tabular form to handle a couple minor tables since I cannot have multiple updateable reports on a single page. The easiest way I could figure to adjust what table I was modifying was to use a select list to choose which table I am viewing/editing.
The select list contains a display of "Supervisor" and "School"
resulting in SUPERVISOR and SCHOOL respectively
the items name is P8_TABLE
Region Source:
select *
from #OWNER#."G06_" || :P8_TABLE
The tables are named G06_SUPERVISOR and G06_SCHOOL
However the query returns:
ORA-00933: SQL command not properly ended
I'm afraid that this won't work. As far as I can tell, tabular form is to be based on one table only (i.e. you can't have a JOIN in there; even if you're displaying values from some other table, you'd rather create functions which would return those values).
That being said, principle you'd like to use means that tabular form underlying table is unknown (as it can vary, depending on what you select in P8_TABLE select list item), which - in turn - means that column names also differ (unless all of those tables share the same column list).
If we presume that above is correct, then I'd suggest you to abandon that approach and maintain every "minor table" on its own tabular form page. It will be just a little bit more typing & clicking, but I wouldn't worry about it.
Hopefully, someone else knows how to do it the way you'd want it to.
You cant make a tabular form query source dynamic. And since the two tables you want to be displayed and be updatable doesnt have common number and usage of their columns, the only way I can think of is separating the two tables and diplaying one tabular form for each table. Though, Apex 4.1 or even the latest Apex 5 doesnt allow multiple tabular form, you can make this possible by using javascript's iframe. You'll need to use javascript since you want to modify the interface of the report/page.

PLSQL Procedure to change data across a full database

I've been asked to write a PLSQL procedure to 'clean up' codes in a database. The codes are varchar2 and are something like 00000001. They are used everywhere in the application. My new employer wants me to make the codes more readable as in turn the 00000001 into just 1 for everywhere they are used.
My question is how would one even go about that? I asked for clarification and it's still not clear and for fear of looking foolish I won't ask again. Any guidance would be welcome
let me start by saying that that sounds like a VERY BAD IDEA!!!!
if you persist it sound like you will need to use dynamic sql with the basic process of...
query all_tab_cols to get a list of columns( im hoping all your columns that use these codes have a naming standard.. ie xxx_CD )
loop over tab/cols to see if your value is there
update values in that table
...
profit ?
however then you get stuck by realities.. if the code is in a foreign key you cant just update it. you'd have to create a new parent record.. update all children to new parent then delete old parent.
you'd need to be very clear on what you are trying to achieve.. and more importantly, is there any value in it?
i suggest you start with a single codevalue to scope out the size of project.
manually start writing the updates you'd need for that 1 codevalue and then try to start automating it.

parameters in subform pulled from main form

I have done this a couple years ago but can't seem to remember how; I am working with access 2010 and the macro builder as opposed to VBA ( I don't do this enough for the coding).
Anyways what I have is a main form that has a subform that displays as a datasheet. This subform data source is a query that asks for three values which are applied as filters using just a where statement.
The query SQL is a select statement, followed by from and then a where statement and no parameter statement.
What I am trying to do is get the subform when it opens to pull the parameters from the main form record it is under.
I know this is possible because I have done this a couple years ago but don't have that database anymore. I have gone through all the books I have and still can't seem to find a combination that works.
Any suggestions or help with what I am missing?
****Update******
The set value isn't working... What I have is a form SQ_Ticket that has fields Site Number, Date Submitted, and End Date. I then I have a sub form that is based on a parameter query, it has a different number of fields then then the ticket query so a Union is too much of a hassle. But the fields in the sub form that would relate to the main form are Site Number and create date.
What I am trying to do is I have the main form (SQ_Ticket) with a sub form (SQ_Alarm_Parameter subform) and the form is a datasheet. When I click to expand the subdatasheet I want the Parameter query to pull the Site Number from the main form and use it to match to the site number in the subform and the pull the Date Submitted and End Date and use it as the start and end in a between statement for the create date in the sub form.
Basically I want to use find all records in the sub form (SQ_ALarm_Parameter subform) that have the same Site Number as the record in SQ_Ticket and that are Created between the Date Submitted and End Date of the Record in SQ_Ticket.
I seem to recall needing to pull the specific data from the main form and then using it as a temp value in the subform, but again can't remember how do to do that.
I know I am missing something obvious since I know I have done this before, but I didn't think to keep a copy of that work and it was quite a while ago. So I really appreciate the help
Firstly, I think taking a few minutes to do the VBA would be valuable and easier to work with. However with the macro method you can just use the Set Value submacro. This won't show up by default so you will need to select "Show All Actions" on your ribbon at the top of Access.
The Macro:
This will allow you to set the RecordSource for one form based off of value of a textbox on another form. You just need to adjust now work with your fields and parameters.

Multiple value selection and optional filter in SSRS 2005 report

I had done a fair share of research before asking this here.
Firstly, i would like to create a drop-down filter #accessVar with the ability to select multiple values. It would be easy if not due to my special requirement. My dataset statement is:
SELECT PASS_M, ENTRY_DT, EXIT_DT, WORKED_HRS, ACCESS_LOCATION_X, IC_N, COMPANY_M, CONSECUTIVE_D
FROM TEMP_TARGET
WHERE (CONSECUTIVE_D >= #consecDays) AND (ENTRY_DT BETWEEN #startDate AND #endDate) AND
(ACCESS_LOCATION_X LIKE #accessVar) AND
(IC_N LIKE #icVAr)
However i need to make use the %wildcard for #accessVar(e.g 'BT%') hence i am unable to use the operator IN. What can i do? I am using SSRS2005. Please advice me.
You can do this using Filter at the Data Set properties. Before that you need to remove the (ACCESS_LOCATION_X LIKE #accessVar) from your data set query.
set the expression as follows[Modify your parameter name].
=ACCESS_LOCATION_X Like "*"+Parameters!param.Value+"*"
Then configure the Dataset properties Filter tab as follows.
After that you can run your report. Following screenshot searches for "en" word in the report data set and returns the result set.
Hope this helps!

Inserting invoice transactions with Dynamics AX / Axapta Business Connector

G'day,
OK, I have now rewritten this question totally:
I am trying to import data into Dynamics through the use of the Business Connector (ideally, I would be importing it directly through SQL but I understand that is not a good idea - however I am open to other suggestions). This is to import invoices from a production system into Dynamics / Axapta (v5).
I can code to insert data into the CUSTINVOICETABLE table, which works fine and generates the RECID. However, new invoices just inserted exist without an Invoice ID (until they are posted I understand). However, I need to insert line items into the CUSTINVOICETRANS table as children of the above entry. For this you need to set the INVOICEID field to refer the above as the link to the parent. However, this does not appear possible before the invoice has been posted. Or I may be way off track?
Does anyone have any ideas or can shed any light for me? That would be much appreciated.
Regards,
Steve
To post a "Free text invoice" simply call custPostInvoiceJob.run() method.
You will have have to make the object first, then call a method with your newly created CustInvoiceTable record.
In X++:
custPostInvoiceJob = new CustPostInvoiceJob();
custPostInvoiceJob.updateQueryBuild(custInvoiceTable);
custPostInvoiceJob.run();
You will have to translate that into Business Connector calls in your preferred language.
Ok, it's actually as easy as it should be.
After the insert statement, simply use the get_Field call:
axRecord.Insert();
recID = (long)axRecord.get_Field("RECID");
You insert the line items in the CUSTINVOICELINE table (which uses a PARENTRECID), then upon posting the items get inserted into the CUSTINVOICETRANS table linked to the appropriate invoice number.
I hope this saves someone from having to work this out themselves.
Steve

Resources