Workaround solution for using PLSQL as a source of interactive report?

Hi all!

I have a PL/SQL anonymous block here, I wanted to use as the source for an interactive report. Only, I didn't know that interactive reports supported PL/SQL...
For example, the code:
DECLARE
a_userid NUMBER;

BEGIN
SELECT userid
INTO a_userid
FROM users
WHERE UPPER(username) = :APP_USER;
EXCEPTION
WHEN NO_DATA_FOUND THEN
a_userid := 0;

IF a_userid = 0 THEN
SELECT distinct a.name AS Foodname, a.foodid AS Foodid
FROM food a 
INNER JOIN foodunit c
ON a.foodid = c.foodid
WHERE a.foodlanguageid = :P18_LANGUAGE
OR a.foodlanguageid = :P18_SET_LANGUAGE
AND a.userid = 0
ORDER BY a.name;
 
ELSIF a_userid = :APP_USER THEN
SELECT DISTINCT a.name AS Foodname, a.foodid AS Foodid
FROM food a 
INNER JOIN foodunit c
ON a.foodid = c.foodid
WHERE a.foodlanguageid = :P18_LANGUAGE
OR a.foodlanguageid = :P18_SET_LANGUAGE
AND a.userid = 0 
AND a.userid = a_userid
ORDER BY a.name;
END IF;
END;
Of course this code will not work because I do not understand everything IN the statements, but just trying to understand what it is that I'm aiming.
This code point is that when a user is not logged (and visits as a public user page), it must fetch the 'NAME' and 'FOODID"FOOD table lines. I added a column of this table (named USERID) and all rows having the value '0' for this column.
Now, when a user logs on, he or she has a fixed username (registered in another table, named 'USERS'). A user is able to add foods that they own to the list.

Of course, a visitor is not supposed to see all food products that have been added to the table by registered users. So, I wanted to show the separate data. Visitors (unregistered) only see the default values (all the lines in which the userid = 0) and registered users should see both added their own food (my username is 1, then I want to see all the lines where the userid = 1) and the rows with default values (where userid = 0).

I found a way here:
http://www.oracleapplicationexpress.com/tutorials/71-Oracle-Apex-interactive-report-based-on-PLSQL-function

But it is not only makes sense to me. Y at - it is an easy way to explain how the tutorial in the link, or you know an easier way? Like making a procedure or something, or a function or a process page and somehow, refer to that in the SQL source interactive report?

Any help is greatly appreciated.

APEX version: 4.1.1.00.23

Hi again,

How does this request?

SELECT DISTINCT a.name AS Foodname, a.foodid AS Foodid
  FROM food a INNER JOIN foodunit c ON a.foodid = c.foodid
 WHERE a.foodlanguageid IN (:P18_LANGUAGE, :P18_SET_LANGUAGE)
  AND (a.userid = :P18_USERID OR a.userid = 0)
ORDER BY a.name

Tags: Database

Similar Questions

  • Workaround solution for use af:foreach with collection

    Hello

    I have a n to m relationship between the two tables to TRANSFER and the USER. I've implemented this n m relationship with a third table, called USR_ASS_REL.

    I have a page detailedUser.jspx which gives me detailed information on all users. If I drag the DataControls USR_ASS_REL field on the screen, I create an array with all of the responsibilities of the user. But this isn't what I want. Instead, I want to print all the assignments on the screen, just separated by a semicolon (by example, assignment1; assignment2;...). I tried to use af:foreach, but that doesn't support the collections. Will there be a chance to do this in a different way? It would probably work if I create a new query asking for assignments to a user, but I don't want to create an additional query for cases like this.

    Thank you
    Brahim

    Hi John, try instead of foreach and it should work. Recent have been prety much more simply in one of my pages:

    
      
      
    
    

    Kind regards

    ~ Simon

  • By using the search field of the interactive report

    Hello

    I want to use the search field of the interactive report to set this value in a page item, use it to pass this value to another feature.

    How can I do this?

    Concerning

    Eve wrote:
    Hello

    I want to use the search field of the interactive report to set this value in a page item, use it to pass this value to another feature.

    How can I do this?

    Concerning

    Create a dynamic action as follows:

    Event: Before updating
    Selection type: Region
    Region:

    Real Action:

    Action: Run the JavaScript Code
    Code: $s ('PX_YOUR_ITEM_NAME', $v ('apexir_SEARCH'));

    Click on create

    When it is created, change the dynamic action and define the scope of the event on the dynamics

  • Using elements of the application of interactive report filters

    Hello

    Can we use elements of application in interactive report filters? If so, how?

    Thank you
    Machaan

    Take a look at the creation of a link to the section of interactive reports in the Application Guide of the user for example generator

    This example binds, resets and clears the saved report parameters 12345. It also creates an ENAME = 'KING' filter on saved report 12345.

    f? p = 100: 1: & SESSION. : I have R_REPORT_12345::RIR, CIR::RIR, CIR:IR_ENAME:KING

    If you have an element of the application P1_ENAME the following apply to the example above

    f? p = 100: 1: & SESSION. : I have R_REPORT_12345::RIR, CIR::RIR, CIR:IR_ENAME: & P1_ENAME.

    If you want a permament for all filter saved reports on the value of point of application, it is best to use the: APP_ITEM_NAME bind variables in your SQL syntax, it really depends on how you define the value of your item and how you interact with it. AFAIK does not request point directly bind variables syntax in the filters, IR etc...

  • Is possible to save the user who uses the download action in an interactive report.

    Hello

    In my application I want to save that downloads information from the interactive reports in any format, is this possible?

    Concerning

    Hi Eva,

    The event would be onClick of one of the download buttons (either CSV, HTML, PDF). Al of these download buttons have an id that starts with 'apexir_dl_' but including the suffix of ASD file extention (so the Download CSV link would be "apexir_dl_CSV").

    The PL/SQL procedure for the actual record is accurately described in the link Tony posted.

    Kind regards

    Vincent

  • Workaround solution for add & remove on XP

    I downloaded a greeting card program that I use from time to time, but in order to save space tried to remove it from Control Panel add & delete and it would not remove. A message says ' setup exe has run "then another message says"to remove go to Control Panel Add & Remove and remove"like this out of here where I am now! Anyway I went on the host site could not find any help, I even sent an email to explain, but no answer, that it has been three weeks presence.

    Is there a workaround to add & delete on Windows XP? I need a walkthrough, Iam not for good one at that. I tried a program free softwere 'delete everything' it would work after a scan "for $20"so "free" much thanks for any help."

    Hello zipper41,

    You can download Your Uninstaller!      HERE

    its a program little wonder and he can do just about everything related to the uninstall, change, delete... it big ... hope this helps

  • All possible means for the conversion of P2V Windows 2008 R2 (even with workaround solutions?)

    We have several production servers, that we have recently upgraded to Windows 2008 R2, only to discover after the fact that VMWare Converter currently does not support convert a physical machine to a VMWare image. The servers are actually images of Hyper-V, but since there is no way to convert the computer virtual Hyper-V to VMWare, we have always used the P2V conversion with our Windows 2008 Server (not R2) without problem.

    Its imperative that we find a way to do this and I was hoping to see if anyone has found any workaround for this problem.

    We would prefer not to have to buy another product for that (i.e. using Acronis or Symantec Backup), as one would expect VMWare to support it eventually (even if it is the only option, we will have to examine it). We simply need a workaround solution for us until they do.

    Thanks a bunch!

    Hello.

    Have you tried the StarWind V2V Converterfree?

    Good luck!

  • Adjust the height of the line in an interactive report for all lines

    Hello
    I have an interactive report with lots of data in certain cells. The height of the heights of lines varies, so that all data is visible in the cells.
    I want to correct or to limit the row height to a specific value, so that all lines are displayed with the same height.
    Do anyone knows how to win this? Thanks in advance.

    Published by: kps204020 on 26.12.2012 20:27

    kps204020 wrote:
    Thanks a lot for your answer.
    I tried your proposal, but it has no effect. The cells in the report show all their content using as many lines as you need for this.

    This is the default behavior for the HTML table data (tables and cells grow to fit their content).

    So I have always with lots of lines, lines and lines with only a few mixed lines in my IR dependant on the contents of the cell. Because some lines almost filling the whole screen, it is difficult to get an overview with regard to adjacent lines.
    I use the Application Express 4.1.1.00.23. with the theme 21. Scarlet and Firefox 17.0.1.

    All users using Firefox?

    In fact, I'm working on my first APEX Solution for use in my business and demanding customers a solution for this topic. So I'm very keen to find a solution.
    I am very looking forward to your reply.

    I have been involved in similar questions in the past. My first reaction is simple: these data must be included in the report? The offending column can be removed from the primary report? They will always be visible in the display of the row and the detail view when it exists.

    The second option is to create a detailed view of the report with a structure that is better suited to the data concerned and make it the default view. (For an example, see the treatment of the PRODUCT_DESCRIPTION column in the detail view of the report in the sample database Application: click the show details on the product page.)

    The third possibility is some sort of customization of the presentation of the data. It will be using a combination of HTML/CSS/dynamic of the Actions/Plug-ins/JavaScript that you may not be familiar with: do you have any experience of these? To go this route, you must describe in detail how you want to present data, or what behavior is required when the data is too long and share a sample of the report on the apex.oracle.com we can work with.

  • Anyone know how to get your money back?  My CC application does not start and I have tried the suggested workaround solutions listed above and they have not worked for me.  The amount of problems listed here in the forum, I have to ask the product is real

    Anyone know how to get your money back?  My CC application does not start and I have tried the suggested workaround solutions listed above and they have not worked for me.  I'm new to the CC Apps but use the versions installed for years.  The amount of questions listed here in this forum, I have to ask the product is really stable?

    Thank you.  I've deleted and reinstalled.  Seems to have solved the problem.

  • By dictating the long notes, using Siri, Siri will stop as soon as I take a little break. Therefore, the note ends abruptly. Any solution for this?

    By dictating the long notes on Mac using Siri, Siri will stop as soon as I take a little break. Therefore, the note ends abruptly. Any solution for this?

    For long notes, you are better to use regular old dictation - under Mac OS for a few years now, Siri is not mandatory.

    To activate it, go to "System Preferences"-> keyboard-> dictation. Once enabled, you can press the "Fn" key twice to activate and dictate the long notes in any application.

    Siri is optimized for short, quick things. I don't think that you can change, you just use the method that is better to listen to what you want to do at the time (short notes, using Siri. Long notes, use dictation).

  • Hi all OneHow can you buy an IBook UK not available in Indian store a store; When you change the status of your country, your billing information and credit cards won't work; is there a solution for this using the same method of billing.

    Hello world

    How can buy you an IBook of UK not available in Indian store a store; When you change the status of your country, your billing information and credit cards won't work; is there a solution for this using the same method of billing

    There is no solution, if it is not available in your area, you can't buy it.

  • Solution for Google Chrome (Helper) by using a lot of ram and cpu on mac os x

    Hi all

    Some people have several tabs of google chrome, and it's using a lot of RAM. It also causes the fan go crazy sometimes. I looked for a solution for centuries, but no solution has allowed, until I stumbled upon the simple solution to use a google chrome extension that hibernates unused tabs. The problem has now completely disappeared.

    There are a few different extensions that Hibernate unused tabs, but the only extension which has enough options setting to do what I want, is called "The Great Suspender".

    You can set the time, after which the Hibernate (sleep) tab. The tab automatically resumes when it focuses on, (i.e., you don't need to then also click on a specific button). And the tabs of the extended day before will remain in hibernation after you restart the computer.

    There are many other parameters that can be changed. (After you have made changes, don't forget to click the 'save changes' button.)

    I hope this helps.

    Thanks for the tip.

  • EventID: 1206 Event Source: Active Directory Web Services ADWS failed to determine whether the computer is a global catalog server. What will be the solution for this.

    EventID: 1206 Event Source: Active Directory Web Services ADWS failed to determine whether the computer is a global catalog server. What will be the solution for this.

    Hi K jtm,.

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet Forum. You can follow the link to your question:
    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • Does anyone have a solution for the use of Bible Illustrator 3.0 MS8 and MS7

    Original title: program programs Application Applications compatibility.

    Does anyone have a solution for the use of Bible Illustrator 3.0 MS8 and MS7

    What are the requirements of system for this program?

    What version of Windows it says on the package, it was designed for?

    If its designed for an earlier version of Windows such as Windows 95 or Windows 98 or XP, then it is probably incompatible with Windows 8.

    If the product packaging indicates anything in the 1990s OR early 2000s, I am afraid that this is not something that is guaranteed to work with Windows 8.

    You can try the following average time.

    Point to the installation files where they are.

    Right-click on the configuration file, and then click "troubleshoot compatibility".

    Wait, it detects the problem.

    Click on the option "worked in an earlier version of Windows.

    Select Windows 7 RTM or better Windows Vista SP2

    Click next

    Click Start the program, wait, it installs

    When the installation is complete, click Finish and save the settings.

  • Premiere Pro is mess up my audio/video synchronization. Use Handbrake really the only solution for this problem?

    Premiere Pro is mess up my audio/video synchronization for the images that I downloaded from my iPhone 6 s + (.) MOV files). The files play fine, but once that I put them in Premiere Pro, the audio falls slowly behind the video, probably to cause "variable frame rate." phone I've seen other threads where people had the same problem, and the universal response, I saw was freeware download called 'Handbrake' to convert the frame rate of variable to fixed... but is not sit right with me.

    Uses 3rd party freeware really the only solution for this problem? Video editing software Adobe Professional-grade not really have the ability to solve this problem? If so, what should I do to prevent all Premiere Pro ruin all my pictures to import?

    Hi Christafarian,

    Premiere Pro is mess up my audio/video synchronization for the images that I downloaded from my iPhone 6 s + (.) MOV files).

    You wouldn't be the first. I'm sorry.

    The files play fine, but once that I put them in Premiere Pro, the audio falls slowly behind the video, probably to cause "variable frame rate." the phone

    I found:

    • If you pull the iPhone in a well-lit environment, it records at a constant speed.
    • In lighting challenged environments, you get images image variable rate.

    I've seen other threads where people had the same problem, and the universal response, I saw was freeware download called 'Handbrake' to convert the frame rate of variable to fixed... but is not sit right with me.

    For this project, you're probably stuck with transcoding with Handbrake or another method not Adobe. Our coders simply do not handle variable frame rates.

    Uses 3rd party freeware really the only solution for this problem?

    With Premiere Pro and this project, you have no other choice. For future projects, look into purchasing a high end video camera application where you can shoot at a constant rate regardless of the stage lighting.

    Video editing software Adobe Professional-grade not really have the ability to solve this problem? If so, what should I do to prevent all Premiere Pro ruin all my pictures to import?

    If you like Premiere Pro to support variable frame rates, please create a feature request. Otherwise, I hope my tips will help you in the future.

    Thank you
    Kevin

Maybe you are looking for

  • How you stabilize the text in firefox to prevent it to default whenever you launch firefox?

    After you have set the text sites in Web sites that they reverse back to default or small when I access firefox overnight. Is it possible to save or stabilise the text so I don't have to change them every day? I have a windows 7 64-bit system.

  • Delete AutoFill suggestion!

    Good evening My apologies if this is in the wrong section, but I don't know where to ask! Basically, I missed part of my email address once when I was typing it and now I always get the wrong suggestion. How can I remove this please? It makes me craz

  • Lumenera DirectShow camera attributes

    I'm trying to get well informed on the contribution of the acquisition of vision software, and I need help.  I am using microscope Lumenera cameras.  I don't have the model numbers in front of me, but I remember seeing information that these devices

  • I have an office jet j4680 all-in-one.

    I want to scan a document in pdf format. I could do it before I upgraded to Win. 7 Vista. Now are the formats that I can scan to PDF list. The listed formats are Bitmap, gif, Tif, and another that I don't remember. It seems to think that everything i

  • Spectrum 13D-3000 Downgrade to Windows 7 - missing drivers

    I shot my 13D-3000 Windows 8 for Windows 7 via an image to a bootable USB drive.  However, when Windows 7 installed many drivers were not installed, including the NETWORK adapter and the USB drivers.  Therefore, I can't access the internet or missing