Restrict VO execution On Page Load - oracle-adf

I have a VO on a page which is displayed as a Table.
So when the Page Loads the VO gets automatically executed and the data is displayed on the page as soon as the page loads.
Can I stop the execution of the VO on page load?
I would like to have the table with no data displayed when the page loads.

You can add a query with a parameter in the business definition. In this paramater you can choose to show or not to show data for example
select * from dual where 1 = :parameter
During the page load you can set parameter to 0 so that the query will result in a blank set. Then inside the page you can put a command button or link to execute the query sending the parameter valued in 1 so that the query result comes complete.

The proper(as designed/intended by ADF) way to do this is to add an AF:query component or AF:quickquery component.
This prevents the query from executing and displaying.
Once the user enters something and executes the query, the target ui component (form, table, etc) will refresh with the contents.
af:query component is based on a ViewCrieria that you build in the VO. A viewcriteria is a named where clause fragment.
The af:quickquery component allows the user to select one of several attributes and execute a query.
Far easier than the suggested approach by User2505647
These may help:
afquery

Related

How to reload child view object completely in ADF

I have a 2 ViewObjects A and B. each connected with a ViewLink. I have shuttled the ViewLink in the ApplicationModule. So B comes under A in DataControl.
I have a Sunburst graph component using this instance. My requirement is to change the ViewObject Query at runtime. This works fine. But the graph is not getting refreshed for the level 2. Only Level 1 getting refreshed.
ie; A is only getting refreshed.
How to refresh B (Or the view link) ?
This sounds weird since view link usually get refreshed together automatically.
Your requirement is change the VO query at runtime. I don't have much details on your implementation, how would you manage to do this? Through an ApplicationModule method ? or some VO manipulation. Anyway, after you update a query, you need to do an executeQuery() right?
A possible way to solve your problem is to call B.executeQuery() after you update A's query.

React router - different content if post in list vs own page

React router has very cool feature: if you have a list of items (Instagram for example) and if you click on one item, content opens in modal/overlay but if you copy-paste the link to new tab/window or share the link with a friend for example, it opens in its own page.
I would love to use this feature but I need to find a custom solution..
My posts are very data heavy
I've split posts data into 2 tables in database
1st is very lightweight containing essential data: 4-5 columns
2nd table is very heave, ~30 columns
When user uses search filter, list updates only with data from 1st table
If user clicks on post, it will open in a modal/overlay
I will recycle the data I already have (from 1st table) and also get rest of the data from 2nd table
However, when user shares the link or opens it in new tab/page, data from 1st table is not present. I would need to integrate a conditional logic:
If post opens in list view (modal/overlay), only get additinal 2nd table data
If it's opened in a new tab/window in its own page, get all the data, 1st table included
How could I integrate this with React router? Has anyone already tried it? This would also allow to use different layout/components when user opens item in page view. Is there a way to check it?
Or is there a flaw in my logic? I imagine list would update very fast because it doesn't require huge amount of data and also would modal/overlay because it recycles some of the data.
I read all the docs, also searched online - didn't find anything.
Modals in react router are great. I've used the pinterest example and adapted it to my own needs.
Ensure you do your check on state.modal===true in a master layout component to give you the modal styling.
you'll need to check if table 1 stuff is present in your state and dispatch an action to trigger the async call in componentDidMount. You should be fetching table 2 in all scenarios.

Can angular ui loader handle complex cases with multiple views?

I have an app with multiple columns (about 3 columns as least), each column is a more detailed view of an item in a column on its left. This type of layout is similar to Asana's.
Lets take an example from 1 of the page I currently have:
Column 1 list all current users, clicking on 1 user will open a list of all sales orders of that user on column 2.
Column 2 show list of all orders of 1 selected user on column 1. Clicking on 1 order will show the details of that order
Column 3 show all details of an order selected on column 2. Clicking on a shipment in that order details will show the details of the shipment
Column 4 show all the details of a shipment selected on column 3
So on a so forth. Now there is another twist:
Column 2,3,4 show these details in a form, which mean they can be edited and submitted. Once they are submitted, it makes sense to reload all the column on the left of that edited column to refresh the info. However, for performance purpose I would like to reload them all in a single request and send them back in one json array hen update each column that has newly returned view code (lets assume the backend code is smart enough to handle all this)
I believe someone must have had this issue before, what is your solution to get around this?
Since you are loading different set of data. Its good not load them all at once. You can use ng-include and the the content of the ng-include can be triggered based on the clicks.
ng-inclue="<<scope variable>>"
For ex. In your controller,
Chnage the value of salesurl based on user action
<div class="slide-animate" ng-include="salesurl"></div>
The scope variable can be an URL, which renders the result set based on the parameters posted after user action.
Hope this help.

Concurrent update on record in Salesforce

In system I am developing, user can access particular page which is used to make DML operation on custom object. I want to fulfill following business case :
User A opens a Page made changes on page but did not click Save.
At the same time User B opens a page made changes and click Save. User B data got saved in record.
Now user A came and click Save. But as data is outdated I want to prompt user that "you are over righting the latest update. Do you want to continue."
Is there any faster out-of-box way available to achieve it ?
Assuming this is in a VisualForce page, you could check if the value has changed inside your Save method.
Query for the LastModifiedDate of all records you may change, and save that in your controller. This should be done in your controller's constructor and/or anywhere you re-load the record(s).
In the save method, first query the record(s) again to check if the LastModifiedDate has been changed. If it has been changed, prompt the user.
Assuming you are trying to insert a record into an object.
You can write a validation rule on that object. Check if that record is already inserted or not and show an error message.
Regards,
Naveen
autorabit

How to force update a DB grid?

I may have been too clever for my own good :-/
I have a table which holds some pressure measurements. These are always stored as PSI, but the user can select a radio group button to toggle between PSI and BAR.
In order to keep the code clean and and push work onto the database, I created a second table for configuration items, with a single row. One column psi_bar_conversion will take the value either 1 or 14.5 as the user toggles the radio group.
In Delphi, my query which ties to my DB grid is set up with statements like
SELECT ROUND(inlet_waterPressure_psi /
(SELECT psi_bar_conversion FROM configuration),
(SELECT float_precision FROM configuration))
AS inlet_waterPressure,
FROM measurements
All of which works just fine (and perhaps I am explaining too much).
All that I am tring to do is add some code in the function which handles the radio button toggle to force my DB grid to refresh its contents becuase I have just updated the value of configuration.psi_bar_conversion (but no direct field of my query, nor of my datasource).
Should I invoke Refresh() or Invalidate() or SomeOtherFunction() - of the DB grid, the query, the datasrouce? That's what is confusing me.
Thanks in advance for any help ....
You need to close and then reopen the query to have the change in psi_bar_conversion and float_precision to take effect. The two sub-selects (for the values from configuration) only happen when the query is executed.
TDBGrid presentation depends on the connected TDataSet (via a TDataSource).
To update the Grid Values you have to refresh the data in TDataSet with the method TDataSet.Refresh.
To update a special Grid you can refresh the connected DataSet like this:
DBGrid1.DataSource.DataSet.Refresh;
But some TDataSet descendants will not refresh and that is documented by Embarcadero
TDataSet.Refresh
It depends on the components you use (i did a test with UniDAC and it works fine)
procedure TForm1.RadioGroup1Click( Sender : TObject );
var
LRate : Extended;
begin
case RadioGroup1.ItemIndex of
0 :
LRate := 1;
1 :
LRate := 14.5;
end;
UniConnection1.ExecSQL( 'UPDATE configuration SET psi_bar_conversion = :conversion', [LRate] );
DBGrid1.DataSource.DataSet.Refresh;
end;
If your components did not refetch the data on calling Refresh, then you have to close and reopen (also stated by documentation)
DBGrid1.DataSource.DataSet.Close;
DBGrid1.DataSource.DataSet.Open;
IMHO such components are not fully implemented, so this is just a workaround having side effects in calling some maybe unwanted events (BeforeClose, AfterClose, BeforeOpen, AfterOpen) which will not get fired using Refresh.
But at all it has nothing to do with SubSelects.
I'm afarid I can't help you with the Delphi side of things here.
On the datbase side of things....
Is there any reason that you can't just store both the bar and psi values in the database?
You could do the conversion when saving and then you are left just to do a simple select on the data when you want to view it. This could be done by the software that is performing the save or by a trigger in the database.
The reason I suggest this is that the psi-bar conversion ratio is not going to change so you are doing a bunch of processing everytime you view the data that is not required...

Resources