Update cell of APEX_COLLECTION in interactive grid - oracle-apex

I have a interactive grid with a full join on the wwv_flow_qb_saved_query table and the apex_collection, like this:
Select
qbsq.ID,
qbsq.TITLE,
qbsq.QB_SQL,
qbsq.DESCRIPTION,
ac.collection_name,
ac.seq_id,
ac.C001 as new_TITLE,
ac.CLOB001 as new_QB_SQL,
ac.C002 as new_DESCRIPTION
FROM APEX_050100.WWV_FLOW_QB_SAVED_QUERY qbsq
full join apex_collections ac
on qbsq.TITLE = ac.C001
The result look like this:
Now I need to make the possibility for users to change the title of the apex_collection, so the title in the "imported queries" column group. If the title is updated and different from the title of the existing queries, there would be a new grid entry.
I tried to do it in the "save interactive grid data" process => settings => target type => pl/sql code with
declare
collection_name varchar2(255);
seq_id number;
new_title varchar2(4000);
begin
collection_name := :COLLECTION_NAME;
seq_id := :SEQ_ID;
new_title := :NEW_TITLE;
case v('APEX$ROW_STATUS')
when 'U' then
APEX_COLLECTION.UPDATE_MEMBER_ATTRIBUTE (
p_collection_name => collection_name,
p_seq => seq_id,
p_attr_number => 1,
p_attr_value => new_title);
end case;
end;
But something just doesn't work and I can't change the title. Am I missing something? Please could someone help me find the problem. I couldn't find any other helpful posts..
Thanks

Thanks to Tony Andrews, for the solution I just had to change in the regions attributes the "Allowed Row Operations Column" to "null".

WHy are you using collection? With IG you can modify data , change the pagination and return to the previous pagination , all your change will be there.

Related

how i can insert file into blob001 column in apex collection table by dynamic action

how i can insert blob file into apex collection table by dynamic action .
I tried that but the bellow error in image appeared how i can solve this issue,
and i tried that by the below code but the NO_DATA_FOUND error Appeared ALSO .
DECLARE
V_BLOB BLOB;
BEGIN
select BLOB_CONTENT
into V_BLOB
from apex_application_temp_files
where name = :P13_FILE;
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'T_FILE',
p_c001 => :P13_DESC,
p_blob001 =>V_BLOB -- FNC_CLOB_TO_BLOB(:P13_FILE)
);
END;
My solution works for Files, I guess it will works for images too. There are two steps:
Declare the item as 'File Browse' (Lets call it 'P1_FILE_BLOB).
On item 'storage type' set it to 'Table APEX_APPLICATION_TEMP_FILES').
the file will now will be stored there...
In your processes (When u click the 'Add' button), you need to pick that file from the 'APEX_APPLICATION_TEMP_FILES'.
declare
filename VARCHAR2(255);
blob_content blob;
mimetype VARCHAR2(255);
begin
select
blob_content, filename, mime_type
into blob_content, filename, mimetype
from apex_application_temp_files
where name = :P1_FILE_BLOB;
apex_collection.add_member(
p_collection_name => 'T_FILE',
p_c001 => filename,
p_c002 => mimetype,
p_blob001 => blob_content
);
commit;
end;
Of course you need to match 'p_c001'... to your own column in the collection table.

exercising ARP on a page with plenty of items

I have an apex form composed of around 50~ text fields and radio buttons.
I tried to create a page process for automated row processing. It works fine but only if my table has a column for each page item.
even though the page items are plenty, actually the question behind them is the same. So what I really want to perform is to collect those data row by row. i.e.
instead of
1 True False True foo
I'd like to store my data like this
1 True foo
2 True goo
3 False hoo
50 False zoo
Since I couldn't find a way to customize ARP, I decided to do it with some manual work.
However I still have this feeling that my efort is futile. I can't help but thinking there must be some other, wiser solutions than being have to create insert/update statements for entire page. I mean I can't be the only one who came up with this need, right?
Thank you very much in advance.
I hope you can achieve your requirement using APEX_COLLECTION. It stores the data temporarily that are associated with the session of the user currently logged into the application. below is the sample code for your reference.
begin
if not apex_collection.collection_exists('SAMPLE_COLLECTION') then
APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION(p_collection_name => 'SAMPLE_COLLECTION');
apex_collection.add_member(
p_collection_name => 'SAMPLE_COLLECTION',
p_c001 => :P1_TEST_ITEM1,
p_c002 => :P1_TEST_ITEM2,
p_c003 => :P1_TEST_ITEM3,
p_c004 => :P1_TEST_ITEM4,
p_c005 => :P1_TEST_ITEM5,
);
end if;
end;
You can select the data stored using the below SELECT statement.
select c001, c002,c003,c004, c005
from apex_collections where collection_name = 'SAMPLE_COLLECTION'
Please refer this link to explore more on APEX_COLLECTION

Get the values of the selected rows with checked checkbox

Having a report of the services table with checkbox for each row, I am trying to get the values of the selected service, so that when I click on next I can create a report with the services chosen in the new page.
I have tried in this way:
Report of the services table.
select code,
name,
cost,
apex_item.hidden(p_idx => 1,
p_value => code) ||
apex_item.hidden(p_idx => 2,
p_value => cost) ||
apex_item.checkbox2(p_idx => 3,
p_value => code) CheckBox
from services
I created a process.
Source:
begin
apex_collection.CREATE_OR_TRUNCATE_COLLECTION ('SDBA_ORDER_ITEMS1');
for i in 1..apex_application.g_f01.count loop
apex_collection.add_member(
p_collection_name => 'SDBA_ORDER_ITEMS1',
p_c001 => to_number(apex_application.g_f01(i)), -- service_code
p_c002 => to_number(apex_application.g_f02(i)), -- cost
p_c003 => to_number(apex_application.g_f03(i)) -- service_code
);
end loop;
end;
Server-side Condition:
begin
for i in 1..apex_application.g_f01.count loop
for j in 1..apex_application.g_f03.count loop
if apex_application.g_f01(i) = apex_application.g_f03(j) then
return true;
else
return false;
end if;
end loop;
end loop;
end;
Report on the next page.
select (select name from services where code = c001) as service_name,
c002 as cost
from apex_collections
where collection_name = 'SDBA_ORDER_ITEMS1'
order by 1
Report on the next page.
select (select name from services where code = c001) as service_name,
c002 as cost
from apex_collections
where collection_name = 'SDBA_ORDER_ITEMS1'
order by 1
In this report it shows all the services of the table instead of the selected ones.
How can I get only the selected rows? Can anybody help me please?
Thanks in advance.
Checkboxes are formed into dense collections, not potentially sparse like the other item types. I think this is a product of web tech, not APEX.
So if you had ID, Name, Checkbox
1 - ada - checked
2 - charles - not checked
3 - alan - checked
There would be 3 index elements in ID and Names array, and only 2 in the checkbox array - and index element 3 would be empty.
So you need to match checkbox existence by indexing by the code value, and checking for existence more like
apex_application.g_f03(apex_application.g_f01.code)
While taking care of potential no_data_found
Reading Oracle documentation:
Note that check boxes displayed using APEX_ITEM.CHECKBOX only contain values in the APEX_APPLICATION arrays for those rows which are checked. Unlike other items (TEXT, TEXTAREA, and DATE_POPUP) which can contain an entry in the corresponding APEX_APPLICATION array for every row submitted, a check box only has an entry in the APEX_APPLICATION array if it is selected.
I've build my report referencing rownum on APEX_ITEM.CHECKBOX.
Report code:
SELECT APEX_ITEM.CHECKBOX(p_idx => 1, p_value => ROWNUM) checkb
,APEX_ITEM.HIDDEN(p_idx => 2, p_value => CUSTOMER_ID)||CUSTOMER_ID CUSTOMER_ID
,APEX_ITEM.HIDDEN(p_idx => 3, p_value => CUST_STATE)||CUST_STATE CUST_STATE
,CUST_FIRST_NAME ||' '||CUST_LAST_NAME
FROM DEMO_CUSTOMERS
And then based on that checked rows, the process is recovering the values in the hidden items arrays corresponding position.
Process PL/SQL code:
BEGIN
--
FOR i IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
--
INSERT INTO ROMINA_TEST (LOG)
VALUES ('CUSTOMER_ID: '||APEX_APPLICATION.G_F02(APEX_APPLICATION.G_F01(i))||' - CUST_STATE: '||APEX_APPLICATION.G_F03(APEX_APPLICATION.G_F01(i)));
--
END LOOP;
--
END;
And it works! =)

Select list display issue

Good morning,
within Oracle Apex Application Builder I'm trying to create a order product page which displays products from a product table, shows a select list which a user can use to define the quantity in which they want to order. Using a classic report to display my code, the declared table columns were generated and outputted on the report, however the select list column only shows the html syntax used to create a select list and not the actual drop down select list with values.
Here is the code:
select p.product_id,
p.product_name,
p.product_price,
apex_item.hidden(1, p.product_id) ||
apex_item.hidden(2, p.product_price) ||
apex_item.select_list(
p_idx => 3,
p_value => nvl(c.c003,'Add_to_cart'),
p_list_values => '1,2,3,4,5,6,7,8,9,10',
p_show_null => 'YES',
p_null_value => 0,
p_null_text => '0',
p_item_id => 'f03_#ROWNUM#',
p_item_label => 'f03_#ROWNUM#',
p_show_extra => 'NO') "add_to_cart"
from prod p, apex_collections c
WHERE c.collection_name (+) = 'ORDER_ITEMS'
and c.c001 (+) = p.product_id
Can someone explain why this is happening, how to correct my issue and if there are better ways to implement a select list; as I need this code to work for my project?
Thanks in-advance for the help!
In Builder, navigate to that column so that you'd see its properties. Scroll down to Escape special characters and set it to "No". Then run the report and see whether there's any improvement (should be).

Symfony2: How can I list table elements in a FormChoice, separating them by some property

Is there any way to fetch objets from the DB and list them by Category? I have a table Artist which have a Genre and each Genre have a Category, so when I'm choosing Genre at new Artist creation I would like to see them separately by each one Category. I recall that in previous versions you could do something like:
$this->widgetSchema['genre_id'] = new sfWidgetFormChoice(array(
'choices' => array('-- Select --',
'-- Category1 --'=>Doctrine_Core::getTable('Genre')->getGenres('Category1')),
'-- Category2 --'=>Doctrine_Core::getTable('Genre')->getGenres('Category2')),
'multiple' => false, 'expanded' => false
));
And the result was a drop down with 'CategoryX' in bold, followed by respectively genres.
After a deep search all I've found is:
->add('group', 'entity', array(
'class' => 'Vendor\MyBundle\Entity\Group',
'label'=>'Group:',
'query_builder' => function(EntityRepository $er) {
return $er->createQueryBuilder('g')
->... // whatever you want to do
}
))
I think that is what I need, but have no idea on how to adapt it to what I'm looking for.
Many thanks.