Pass an URL parameter to public page and query by it (Oracle Apex) - oracle-apex

I need to call public apex page (without authentication) and pass parameter to it through the URL
and make the page to query a table with that parameter when page load
for example pass employee id through URL and the page display the employee data
if you have an example of dummy page it will be great
I am using Oracle Application Express 20.1.0.00.13

Example for the emp table of one way to do this. I'm doing it with a report but you should be able to figure out based on this how do do it with a form too.
Create a page of type "Report > Interactive Report". Select table "EMP" and create the page.
Edit the page in page builder. In my case this the page nr is 15.
Create page item P15_ENAME of type "Hidden"
Modify the report region: set WHERE clause to ENAME = :P15_ENAME
Modify the page properties: set authentication to "Page is public". Save.
Run the page with the url like this <hostname_and_path>/f?p=<your_app_id>:15:::::P15_ENAME:KING (replace the values between <> with your own).

Related

Oracle Apex set select list value in session state without submit page on change

How save selected value from select list in session state without submit page on change?
Example work with submit page!
Create a dynamic action on change of P245_YEAR
Action type: "Execute Server-side Code"
Language: PL/SQL
PL/SQL Code:
NULL;
Items to submit: P245_YEAR

How to give link for 3 different URLs on single button using select list in oracle apex

If user selects one option from select list then that button should link to different URL, if user selects second option from that select list then that same button should land at another URL , Kindly help me in it using ORACLE APEX.
Create a page item P1_URL of type select list
Add a couple of entries - for this example I'm using static values but a query should work too. Make sure the return value of the entry contains the actual url:
Create a button with action "Submit Page"
Create a branch
Execution Options > Point > "Processing"
Type: "Url defined by Item (Redirect)"
Item: P1_URL
Run the page, when you click the button the page should redirect to the selected url.

How to fill a update form with values using :APP_USER id in Oracle Apex?

I have a classic report which shows profile details of a user. There is "Update Profile" button on the top of the report which when clicked redirects a user to a form from which the user can update information. I want to populate the fields in the form with the present data of the user
If I had used interactive report than I could have passed the "student_id" to the target form page. In classic report I cannot do so. I tried passing the :APP_USER instead of "student_id" but that didn't work. How can I solve this issue.
It would be better if the form can fill itself with the :APP_USER id without passing the id from the report
How can I do so?
I tried doing it by passing where clause in Source section as show in the bellow pic:
It didn't work. The form is still empty
In the form region attributes, under "Source", there is an attribute "Where Clause". You can use that to only retrieve the row for the currently logged on user.
Example:
username = :APP_USER
Replace "username" with the column name in your table

Save the dynamically populated value on dropdown

I'm using wagtail CMS for Django, I want to add a dynamically populated value for a dropdown and save it on the Page model, this is my code:
class MyPage(Page):
domain = CharField(max_length=10, choices=MY_CHOICES)
subdomain = CharField(max_length=10, choices=[('', '------')]
I've got some frontend logic to populate dynamically the options for subdomain, but after I hit save I got: The page could not be created due to validation errors And in the subdomain field: Select a valid choice. [my value] is not one of the available choices.
I can't use ForeignKey to populate subdomain because it depends from an external API service that we're using.
I tried to use a custom field that inherits from CharField with no success, it looks it executes validate method only for the domain field.
If you use the choices argument, you have to predefine the list of possible values. Read the relevant part of the docs (last two paragraphs of that section).
You could omit the choices argument from the model field definition and only render a HTML select tag in the frontend (which is then filled with options dynamically, like you explained).
You could also look into changing the default widget of the CharField to a select tag, like this answer and this part of the docs show.

How do I get the value of a WFFM field as a tag and output it in a Sitecore DMS report?

If I create a Web Forms For Marketers form with Analytics enabled I can choose to add each field as a tag to a Visitor. I can't see how to configure which tag they should be added to, or even what the tag is called by default (I'm assuming a tag with the field name is created).
I'd also like to know how to retrieve the tag data in a visit report (i.e. the one you'd get if you double clicked on a form submission in the Form Reports dialogue). I can see how to access plenty of inbuilt tags, but I can't find out how to fill these specifically from the form, and I cant see any fields in the report designer representing the field names I have.
Question 1: How to set the name of the tag
If you set the "Tag" checkbox on the form field, the Item Name (=field name) of the form field is used as tag name.
If you have database access, you can check the "VisitorTags" table on the analytics database to see which tags are written and how they are called.
Question 2: Retrieve Tag data in visit reports
In the VisitDetail report, the following inbuilt tags will be displayed if set:
Email
First Name
Second Name
Company
Organization
Full Name
StateProvince
Name your form fields accordingly and the values will be used in the report out of the box.
If you want to use custom tags in reports, have a look at the .mrt files in /sitecore/shell/Applications/Reports/. You will have to extend the report to use your own tags.
Example: Adding a custom tag to the VisitDetail report.
Extend the SQL Query to fetch tags in the /sitecore/system/Settings/Analytics/Reports SQL Queries/Visits Visitor Tags item. Add the line
, MAX(CASE WHEN [TagName] = 'SomeCustomTag' THEN [TagValue] ELSE NULL END) [SomeCustomTag]
Extend the VisitDetail.mrt, add a column with value SomeCustomTag to the VisitorTags section just like the predefined tags.
Use the value of your custom tag inside the report text by using {Visit.VisitorTagsRelation.SomeCustomTag}
I use a text editor to edit the .mrt files, but you can probably also do it in Reports Designer.