How to programmatically create ListView based off SQLite query? - android-listview

I have some code that allows the user to perform a search by selecting a few checkboxes. A sql query is then created based on what checkboxes are checked. (Up to 5 checkboxes)
The data is then queried against a sqlite data.
The issue is now how do i populate the data into a listview (not knowing how many columns there will be ahead of time (Could be anywhere from 1 to 5)
All the examples I"ve seen is where the listView is created and you know exactly how many colummns are going to be returned.

A previous posted suggested to query all the records and then use if statements to determine if the value is null then hide column.

Related

Loop through database ANYLOGIC

In my model I want to loop through the database which contains multiple columns (see example) by an event. The idea behind it is that I want to create dynamic events based on the rows in the database.
But I've no clue how to iterate through a database in anylogic and also was not able to find an example of a loop with a database.
The dummycode of my problem would look something like this:
For order in orderdatabase:
Create order based on (order.name, order.quantity, order.arrivaltime, order.deliverylocation)
Where order in the loop is every row of the database, and the value on which the creation is based based on the different column values of that specific row.
Can somebody give me a simple example of how to create such a loop for this specific problem.
Thanks in advance.
Use the database query wizard:
put your cursor into a code field
this will allow you to open the database wizard
select what you need (in your case, you want the "iterate over returned rows and do something" option
Click ok
adjust the dummy code to make it do what you want
For details and examples, check the example models and the AnyLogic help, explaining all options in detail.

How to create queries dynamically based on filters selected in PostgreSQL?

I have a UI where products of various categories will be listed. There will be filters on various attributes which users can select to filter out the products. How should I create a query which will change dynamically based on the selection of filters? Further, once the result set is ready, only few rows to be displayed at a time to the user e.g. 10 rows at a time; value of which again will be decided by the user.
You could write a PL/pgSQL function that takes a JSON with filter fields and values and returns matching rows. But there are libraries for doing that, why not use one of them. What is your UI built on?
On pagination, see Five ways to paginate in Postgres

Google Chart - DataTable inside a form

I have a table created with DataTable of Google Chart, which has a column with a drop-down list. In this way the user can set the proper value of a row.
I am working in Python and Flask and I can retrieve the request data correctly. The problem is that the table, given the amount of data, is showed in pages, each one with 20 rows. When I retrieve the request I get only those 20 rows, so I have no way to know what the user set in the other pages.
How can I get the values of all pages?
Moreover, I noticed that when I change page and then I go back, the table forgets the user changes, so I think I should be careful also to this fact.
Finally, I solved the problem by using a dictionary containing all the changes made to the table and updating the html string inside the table to keep the content updated.

How I can add a row and input field on button click in lotus note 8.5. form?

I have question about Lotus Note. I have form: http://i.stack.imgur.com/YWii6.jpg
In this form I need create bottom. With this buttom user can add new row with input field in this row to existing table. I find that kind of lotusscript from:
http://www-01.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/com.ibm.designer.domino.main.doc/H_EXAMPLES_ADDROW_METHOD_RTTABLE.html
But when I this script copied to this form, I get error "Object variable no set"
Then I tried this solotion:
LotusNotes 8.5 - Adding a row to a table with a button
And I again get the same error.
Can anybody tell me please, how I can create new row and input field in this row, when I pressed buttom "Add row"?
You can't make a table with a dynamic amount of rows in a Lotus Notes Form. There are two common ways to solve this:
Use child-documents; one document for each row; and show these documents using an embedded view. This is the most elegant imho.
Create a large, fixed-elements table, and hide the rows that are not needed (for instance, by checking the presence of an input in the preceding row. This is OK for small amounts of row, but performance starts getting bad if you have too many rows.
It seems you are a bit confused as to the difference between a form (your picture) and a document (the code you link). Also, you definitely need to understand the meaning of "Object variable not set", which is the most common error when you use Lotusscript.
Anyhow, where to go from here depends on how you plan using the data once it is input. Will it be edited ? Will each row need to be handled as a separate record ?

Inserting rows in form datasource, insert is OK, rows are not visible

Basically, I want to insert rows in the form InventJournalTransfer. I added a menuitem button that calls a class which opens a dialog where I fill a WMSLocationId, then I loop on Inventsum table to get all ItemIds with Available qty for this WMSLocationId and insert them into InventJournalTrans Table.
The code I wrote seems to be working as I have correct records inserted in my table(visible in Table browser, correct journalId, linenum itemId, qty etc...) BUT the records inserted do not appear in my form. I tried to refresh my form with or without code, but my grid's still empty.
I had a look at the class InventCountCreate that does what I want to do in a different journal type, but as I'm quite a newbie it is difficult for me to understand exactly how this class works.
Could anyone explain to me how to display my inserted rows in my form or give other leads?
The InventJournalTrans is table is inner joined to two InventDim, one related via the InventDimId field, the other via ToInventDimId.
Both fields must be filled with a valid InventDimId to an existing InventDim record for the form to show the record.
Have you tried right-clicking on your form's node in the AOT and clicking "Restore"? Perhaps your form is still using cached data.