Using a table selection in script
Hi,
I'd like to be able to scroll through a set of records in a table and update values on each record. I want to select the records using the selection feature on table view, as used for bulk update, delete etc. Is that possible?
13 replies
-
Hi Chris -
Most things are possible in Ninox.
said:
I'd like to be able to scroll through a set of records in a table and update values on each record.I'm not sure what you want to do here? You can already do this in the table view. You can double click on a column and update the data.
said:
I want to select the records using the selection feature on table view, as used for bulk update, delete etc. Is that possible?Can you add some more description of what you want to do? Maybe describe a work flow that you want to do.
-
Thanks Fred, should have been more descriptive. Basically I'm trying to bulk update records which I manually select and which are not necessarily selectable by query. I can't do it using the bulk update feature as the fields to update are linked to other tables. I will create a form with links to the relevant tables and select the values to update to, then scroll through the selected records updating using linked record IDs. I could use bulk update/assign calculated values, but that would mean looking up the ID's and entering the formula for each of the four fields every time I want to do it.
I am using the DB to track the films I shoot (I'm into analogue photography!) so record camera, lens, film, location etc. I batch develop the films, so need to add fields for chemistry, time, temperature, agitation which are all selected from linked tables. Currently I add these details individually, but a bulk operation would be a useful embellishment.
-
said:
Basically I'm trying to bulk update records which I manually select and which are not necessarily selectable by query.May I recommend that you look into using a dynamic multiple choice field. This will allow you to select the records you want to update.
You can see it in action with the attached DB. In the Dashboard table you can select a Customer then it will bring up the Outstanding Invoices. You then enter an amount into Amount Recieved, make your selection of invoices then click on Pay Selected and it will do its magic.
-
Here is a link to a copy: https://www.dropbox.com/scl/fi/q9st7plthznmjmb116y7x/Copy_for-Fred.ninox?rlkey=pibbfqz583gf2ej9efii6ev6y&dl=0.
It will open the Maintenance Dashboard and I've added couple of explanatory notes. -
You wrote in the DB: I would like them to include records where Film.Chemistry id empty when ‘Select Chemistry’ is empty.
Just to verify, you want to show records in Film where Film.Chemistry = 'Select Chemistry' and Film.Chemistry = null?
or
Do you want to show records in Film where Film.Chemistry = null when 'Select Chemistry' is null?
You can also attach files to post. Just click on the paperclip icon above the Save/Cancel buttons.
-
said:
I am struggling to see the difference between your two scenarios, but I think the later is a clearer descriptionPut another way, the first scenario asks if you want to include Film records that equal the selection (when Chemistry = 'Select Chemistry') and when Chemistry = null?
The second scenario ask if you only want records where Chemistry is null.
Try this in the Dynamic Value:
let t := this; if 'Select Chemistry'.Film != null then select Film where Chemistry = t.'Select Chemistry' else select Film where Chemistry = null end
Line 1, uses the the this command to get the record Id (rid) of the current record. Which then allows you to then access any field of the current table later in your code. You see this in line 3.
Lines 2 - 6 is the if then statement. While you used the reference field of 'Select Chemistry', we have to switch to the select statement because we need to access the entire table if we want to find all records where Chemistry = null.
Content aside
- Status Answered
- 7 mths agoLast active
- 13Replies
- 97Views
-
1
Following