How to refresh form when I open? - forms

I have a CheckBox in my TabPage on my Form, if I select the checkBox, the value is saved in a Table field (present in my FormDataSource: ParametersTable).
I want to refresh the form when I enter in TabPage, just Like pressing F5.
Is it possible?

There is a great article about different methods of refreshing the form's data here. Here are the basic outline:
1. Refresh
This method basically refreshes the data displayed in the form controls with whatever is stored in the form cache for that particular datasource record. Calling refresh() method will NOT reread the record from the database. So if changes happened to the record in another process, these will not be shown after executing refresh().
2. Reread
Calling reread() will query the database and re-read the current record contents into the datasource form cache. This will not display the changes on the form until a redraw of the grid contents happens (for example, when you navigate away from the row or re-open the form).
You should not use it to refresh the form data if you have through code added or removed records.
3. Research
Calling research() will rerun the existing form query against the database, therefore updating the list with new/removed records as well as updating all existing rows. This will honor any existing filters and sorting on the form, that were set by the user.
4. ExecuteQuery
Calling executeQuery() will also rerun the query and update/add/delete the rows in the grid. ExecuteQuery should be used if you have modified the query in your code and need to refresh the form to display the data based on the updated query.
I strongly recommand that you read the article. Try to use some of the methods above or some combinations of them.
Start with research() method, it might solve your problem:
formDataSource.research();

Related

Smartsheet-api, Is there any way to get manually deleted row using smartsheet api or sdk call

I am deleting row from a sheet, On a sheet I have daily job which needs to recognize the deleted records, I need a way to recognize them using smartsheet api or sdk..
Thanks in advance..
I don't believe this scenario (identifying deleted rows) is explicitly supported by the API at this time. Seems like you could still use the API to achieve your goal though, with a bit more work (code) on your part.
Your code would have to get the sheet data (i.e., all sheet rows) at a regular interval and save that data somewhere -- then each time job runs, get the sheet data again and compare that data to the data you saved the previous time the job ran (to identify any rows that had been deleted).
Edit 9/26: Added Webhooks info
Note that with the approach I've described above, any rows that had been added AND deleted during the interval between job runs would not be detected. If it's important to identify each and every time a row is deleted, a better (and much more efficient) approach would be to use Webhooks. By using webhooks, your application subscribes to notifications for a specified sheet, and then would receive a callback (HTTP POST) from Smartsheet any time the sheet changes. Your application would need to inspect the information in each callback it receives to identify 'deleted row' events (eventType = deleted and objectType = row).
A simple way to do this is to add a column with a checkmark named "delete" or something similar, then with automation you can move the row to another sheet when the flag is detected, the row will be removed from the original sheet, but you will have a record of the deleted row in a different sheet that you can read or do what ever you need to do, this will also prevent deletions by mistake and you can even restore the row back if you need to. I don't think you need much code to implement this solution.

How to add multiple new rows to a DbContext?

My question seems similar to this one but the exact details as well as the solution seem to have changed over the years. (For one thing, the ObjectStateManager referenced in the accepted answer is apparently no longer accessible.)
I have a web app that displays an object graph. One of the objects in the graph is a list. The user can edit the items in the list. They can also add new items. When they save their changes, I serialize the whole object graph (including a field indicating whether values were added or modified) and send it to a controller to update the database. I send the added items with uninitialized IDs. In the controller, I deserialize the object graph and pass it to DbContext#Attach(). Then I set the entity states of the attached entries before calling SaveChanges().
This works with any number of changed rows, and it works with a single added row. The database assigns an ID when a row is inserted. But Attach() does not accept multiple added rows with the same uninitialized ID.
Is there a way to suppress the validation of IDs in Attach()? It seems like EF should leave that up to the database. Failing that, how should I go about this?

how to put more than 1 record in an oracle apex form?

I have a problem with oracle apex forms.
The problem is that I want to add more than 1 record at the same time in 1 form. I have already read that the best way to do that is to use an csv file but then there is no tutorial to do that.
Oracle is a database, and combining files with databases is always tricky and not extensively supported for obvious reasons. Storing files and presenting them for download is one thing. Getting an Oracle database to open a file and reading and processing the contents is another. It sure it possible, but especially combining this with an Apex application I think you are going to run into a lot of challenges such as security restrictions.
However, stepping away from files does not necessarily mean stepping away from CSV. You could simply offer a large text input on your page in which a user can copy-paste a large CSV string. This can then be submitted and processed by the database. To do this you would probably need to create a process that gets fired after you submit the page. From this process you can parse the CSV data and insert multiple rows in a table. The same can be done for things like XML or JSON.
However, who is generating this CSV? Requiring a user to construct CSV is not very user-friendly. It can be complicated and error prone. If the CSV is generated by another application, isn't there a way to circumvent Apex and pass the CSV to the database directly?
If a single text-based data carrier is not required, which I doubt reading your descriptions, why not simply keep your form but allow the user to submit multiple forms? Would if be sufficient to insert one record per submit, and later using a batch to query these records and start formatting one at a time?
If you simply want the user to be able to enter multiple machines without having to submit the page for each machine, this is also possible, but you will have to leave some standard Apex functionality behind and implement some more custom javascript and PL/SQL functionality. Apex only allows a static amount of page items, which needs to be defined design time. So if you want to dynamically add fields such as text boxes and select lists to your page, you will have to resort to javascript. You could start by defining a region which renders one row of input fields at page load, and create a link under it saying 'add another row', which will render a new row of input fields under the existing one, and repeat this as many times as the user needs to.
That takes care of the UI. Now when the user has entered all the data he wants, we need to submit all this data and get it into the database. So yes, at this point we would probably have to get all this data from the input fields and turn it into one single string. This would all have to be done client side in your javascript code. You can then use the Apex page item API to assign this generated string to a single page item, using the $x(...) or $v(...) functions. Then submit the page, at which point the page processes will be fired. You then define a page process which will parse the data in your page item, and use that data to insert multiple rows in the database.

How to prevent Kendo UI Grid from rebinding many times when updating ViewModels

When you bind to a Kendo UI Grid with MVVM, databound will fire once and all is well. If you need to update that data after the fact, every time you change one piece of data on any viewmodel (or child viewmodel), the entire grid re-databinds. Thus, if you had some cell in the grid that is bound to a template and you have to change 2 or 3 properties on the viewmodel from some external ajax source, Databound will fire 2 or 3 times for each model that is changed, causing the entire viewable area to rebind. How can we update lots of data at once and only have databound fire once?
How exactly you rebind the Grid? Basically if you change some of the models like this:
dataItem.set('SomeField','new value');
dataItem.set('someOtherField','other value');
This way the Grid will be indeed bound two times because of the MVVM. The change event is triggered each time you call set.
However if you update the values like this:
dataItem.SomeField='new value';
dataItem.someOtherField= 'other value';
The Grid wont react to the change and wont rebind re-read the values from the models you can force the Grid to do it through the refresh method.
$('#gridName').data().kendoGrid.refresh()
I'm not sure if there is some way to temporarily tell the grid to stop listening to events and then at the end, re-sync once. If there is, please give that answer here! Otherwise, what I did instead is I didn't go through .set() for each item. Instead, I updated the data for all the rows by setting the data directly to the property. Then when I got to the very last row I was updating, I called .set() on the last property that needed to be updated. This will cause databound to fire only once and the entire grid will refresh itself with all the data that was changed. If you don't do it this way, then the more rows displayed on the page, the longer it takes to process. (It could take 20+ seconds before the user can do anything again.)
It looks like the dataBinding event is where you can prevent a rebind on the grid.
Telerik Online Docs

Refresh the Parent form of "Call_form" after Child form is closed in Oracle 10g

What I need is:
what trigger to use and where to put it.
I will give you an example of what I am doing.
I have a Contract form that is fully editable except the contract financial areas, which is read only. I want the user to press a button called, “change rates” and that will have a trigger “When-Button-Pressed” and call_form(UpdateFinancials);.
Now, in this screen, I have the user change the financial information such as increase the contract from 50k to 100k. Then the user saves and exits. This will then close the child form "UpdateFinancials" and show the parent form "ContractForm". The problem is, it still has all the old information on it. I need the information in the form to refresh when it gets back from the child form of the Call_Form function.
In the WHEN-BUTTON-PRESSED trigger, before you issue the CALL_FORM, set a variable (e.g. a hidden item or a global variable) to some value, e.g. 'CALLED_THE_FORM'.
In the WHEN-WINDOW-ACTIVATED trigger, test the variable, if it's ='CALLED_THE_FORM', reset the variable (e.g. to NULL), and run whatever code you want to run when the user returns from the form (e.g. execute query or whatever).
Alternatively, just execute query from the WHEN-WINDOW-ACTIVATED trigger - if you want the refresh to happen every time the user returns to the form. But personally I prefer to only refresh when I believe it is absolutely required.