I am developing a mobile application that should allow a student to search for job vacancies. I have used the wizard to create a form with a list view. The list view will only show job titles which are not past their closing date (available jobs)
When a job title is clicked it redirects to the form where the student can view further job details. These values are passed automatically by the wizard.
Now while this whole thing is great I need information from 3 different tables and the wizard won't help me with that.
I have created a list view based on an sql query and also a form based on an sql query. I have tried to create automatic fetch processes to pass the values from my list view to the form view but nothing I have tried has worked. I carefully analysed the forms created by the wizard to see how it could be done but nothing worked for me and I would really love to do it in this way.
For reference this is the sql code I used for the list view (and it's the same for the form view except for the where clause )
T1.JOB_TITLE,
T1.SALARY,
T1.JOB_DESCRIPTION,
T1.START_DATE,
T1.CLOSING_DATE,
T1.METHOD_ID,
T3.METHOD_NAME,
T1.SITE_ID,
T2.CITY,
T2.ADDRESS_FIRST_LINE,
T2.EMAIL,
T2.COMPANY_NAME
FROM JOB T1
JOIN SITE T2 ON (T2.SITE_ID = T1.SITE_ID)
JOIN APPLICATION_METHOD T3 ON (T3.METHOD_ID = T1.METHOD_ID)
Where (T1.Closing_Date >(Select Current_Date from dual))
There are really two ways you could solve this:
1) If you can simply pass the values you need to the form page, edit the values of your Form region, and open up the "Link Target" attribute (this is assuming you're using APEX 5 Page Designer). There, you will be able to pass in multiple values to items on your Form page.
2) If, instead, you need to derive these values on your Form page, add an After Header process on your form page and do the lookups from your other tables in this process, using PL/SQL. You can use the bind variable syntax to reference your items and update session state. For example:
begin
for c1 in (select val1, val2 from my_other_table where id = :P3_ID) loop
:P3_ITEM1 := c1.val1;
:P3_ITEM2 := c1.val2;
exit;
end loop;
end;
I managed to add the additional columns by adding more items and selecting an Sql-query that returns a single row from the item attributes (Source).
So in order to get method_name rather than an ID which would be irrelevant for the end user I used this code:
SELECT METHOD_NAME FROM APPLICATION_METHOD
WHERE (METHOD_ID = :P3_METHOD_ID)
I am fairly certain that it might not be a great solution if you have a lot of columns that need to go through but it was easy to understand and implement for a few additional columns.
Related
I have a site that the user selects a drop-down menu item, inputs some JSON, and then clicks "Parse". Then the JSON data is checked against certain properties based on the drop-down menu item. Basically I have a list that looks like this.
myList = [{'Prop1': ['asdf', 'wefef']}, {'prop3': ['ss']}, {'prop2': ['d']}]
This is all the data I am checking against. It is the property name and then a list of expected values for that property name. Then in the JSON I have to compare those properties against the JSON properties in the list above.
Right now I am not sure where the best way to go about checking these. Should I do it in my views.py or should I do it in the page.html?
Basically I will need to look through myList and check if that property is in the JSON. If so then I need to check it against the expected property. And then I need to print things in a row so that you can view the info like:
Property Excepted Value Actual Value P/F
prop1 asdf, wefef apple F
prop2 d d P
prop3 ss sd F
My issue is, this will be a bunch of logic to build out to parse correctly. I am new to Django and not sure if the amount of code should be done in the HTML file. Else, I would need to build a large string in the views.py that contains all the data and the HTML, then pass to the HTML file and just display a single variable that displays all the data.
It is a good practise not to put too much logic in your page.html - it should just display your data. Therefore, put the logic into your view.
It also has the advantage that you can test the functionality way easier.
I am pretty new to python/django, but previously programmed in C# and VB.Net. I need to create a list on my django form that contains data elements from a PGSQL table. The user should be able to select multiple rows and then I would formulate a query that I would send back to the server. I have researched, but have not found anything to point me in the right direction. I will show my code below.
forms.py
PROD_MULTI_RECORDS=[
('darryl.dillman','darryl.dillman'),
('richard.mcgarry','richard.mcgarry'),
('janet.delage','janet.delage')
]
class rdsprodform(forms.Form):
selectmulti =
forms.CharField(widget=forms.SelectMultiple(choices=PROD_MULTI_RECORDS),
required = False, label = "Please select records to process")
I have a class called State in my model and a states select (combo box) in my page. I need to create the step definition that compares the values in the database to the values in the combo box.
I've been able to find the combo box by its ID, but I couldn't find a way to compare each option.
expect(page.find_by_id('patient_state_id'))
How can I do this?
I've been able to solve this with the following code:
Given(/^I am an application user$/) do
end
When(/^I display the patient registration form$/) do
visit('/patients/new')
end
Then(/^I should be able see the list of registered states$/) do
states = State.pluck(:description)
page.find_by_id('patient_state_id').all('option').each do |el|
expect(states).to include(el.text)
end
end
am Using Apex4.1,
in my application I have one Tabular form which has the following fields,
Emp_id
Emp_name
Dept_id
Here Emp_id is the Updatable column and it is a select list LOV and
Emp_name is a upadatable column,
Here what I need is,
If I select the Emp_id from the LOV ,the Emp_Name should be stored automatically based
on the value selected in EMP_ID,
In tabular form I could not create Dynamic action like creating in normal forms,
Can anyone help me in this issue?
Thank you.
APEX does not currently provide dynamic actions on tabular form items. Hopefully this may be addressed in APEX 4.2 but the Statement of Direction does not explicitly say so.
So for now if you need to do this you will have to write your own Javascript, using the unique IDs of the tabular form items to manipulate them (the IDs look like "fcc_rrrr" where "cc" is the column number and "rrrr" is the row number). See this SO q&q for sample Javascript code that uses these.
The Javascript you need to write is a little daunting (for a beginner), but one thing to note is that in your case you can avoid any need for using AJAX to get the employee name by embedding the name in the return value of the LOV something like this:
select emp_name d, emp_id||':'||emp_name r
from employee
order by 1
This way the return values will look like '123:John Smith'; your Javascript can parse this string and extract 'John Smith' and insert it into the emp_name item on the same row. Obviously you will also need to parse this string to obtain the emp_id value you will need when updating the database when the page is submitted.
I have a Django app that displays a list of rows in a table to the user. Each row maps to an entry in a database. I want to let the user select the rows they would like deleting by adding a checkbox to the end of each row and a delete button ( similar to how gmail lets you delete multiple mail messages). I can't quite figure out how to write the view in terms of finding out which rows were selected and how to map these to the IDs of the entries that need deleting from the database. A simple code snippet showing how to do this would be greatly appreciated.
UPDATE:
I've found this code snippet that I think should do the trick
You can use the CheckboxSelectMultiple widget to auto-generate the corresponding HTML code so you don't have to do it manually.
You can define your form like so:
class UsersForm(forms.Form):
users = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=[QuerySetIterator(Users.objects.all(), "", False)], label="")
Another advantage is that you also get validation for free.
Create a formset and pass can_delete = True to the constructor. Then, in the template,
{{formset}}