Generating values for dropdown ONLY for 'C' of CRUD - listbox

When choosing 'Add' in CRUD, how best to generate a list of choices to pick from a dropdown?
For U/update - just display what's there...
The field contents starts with a letter, followed by five numeric digits:{A-I,K-N,Z}#####
Each letter has a different 'max' value for the numeric part.
So when adding a new record, I'd like to offer a listbox with one of each letter and that letter's highest numeric value + 10.
So, if the max 'A' as A00120, and max 'B' B00030 (etc) the listbox would have A00130 and B00040.. etc
Save the user having to figure out which is 'next' when generating a new record.
? Thanks,
Mark

This time I'll not be able to come up with ready to use solution, but I must say - everything is possible with ATK4. You just have to customize and extend it to fit your needs :)
Speaking about your question above - I guess you have to split it in multiple parts.
First part is about how to show select box on Create and readonly or disabled field on Update. I guess you can make some custom Form field or pin some action to existing Form Field hook. Not sure exactly what's better in this case.
Second one is about data structure. I believe that this field actually should be 2 fields in DB and maybe (only maybe) merged together in ATK model with addExpression() just for user interface needs to display these 2 fields as one field easily in UI. Maybe such concatenated field will be useful also for searching, but definitely not as only one field stored in DB. Imagine how hard it'll be for DB engine to find max value if such field. Store it like type = letter, num = number and then search like SELECT max(num)+10 FROM t WHERE type='A'
Finally Third part is about how to generate this next number. I read your question 3 times and came to conclusion that actually you don't have to show this +10 numeric value in UI at all if it's hardly predefined anyway. Actually that'll not work correctly if this will be multi-user system which I guess it will. Instead just show simple select box with letters {A-I,K-N,Z} and calculate this next value exactly before inserting data in DB. That can be done using models insert hook. This will be much more appropriate solution and will be better for UI and also more stable because calculated in model not incorrectly in UI part.

Related

want to name the formula in drop down list

in my original workbook i want to display some values from another sheet for multiple actions.. so i put drop down list for each actions. but when the actions increased i couldn't recognize each formulas. (all of them are import range) so that if i can name each formulas in the drop down then i can recognize fast which action to be performed. here a sample sheet is attached for a solution.. pls take a look. in the dropdown list i included (=a2+b2) instead of that if it displayed as addition in drop down list would be help ful. please take a look.
sorry for my english
Any type of help would be appreciated.
https://docs.google.com/spreadsheets/d/1mpIWyQASMlxRVdlTkv9K1e4oihsrckjT6sD1mLDxvEc/edit#gid=0
If I understand correctly, you want to have a dropdown list menu (from Data Validation) that displays the operation name, but when you click it, it displays just the result.
This is very hacky, but here's a way to create some "labels" in your criteria box:
=IF(;"ADDITION";A2+B2),
=IF(;"SUBTRACTION";A2-B2),
=IF(;"DIVISION";A2/B2),
=IF(;"MULTIPLICATION";A2*B2),
How?(!)
After kicking around some no-op ideas, I finally settled on this as the cleanest and most flexible approach. (By some freak coincidence, it also makes some semantic sense too.) It works because when the first argument to IF is omitted, it defaults to 0 -> FALSE. This effectively makes the second argument to IF a comment/no-op, and always just selects the formula.
Yes, the semicolons are intentional or the parser will think of the args as list items.
Productivity Tip/Footnotes
Sheets will remove any line breaks in your validation criteria, so the formula will be hard to read when you have to edit it. If you anticipate that you'll be adding a bunch of functions later, save the above block in a text file and edit that. Then you can copy+paste it into the validation field.
It will also always show up as "INVALID" because the value will of course never match the formula text.

List or auto-complete existing string values, for new plaintext cell

I have a plaintext column in my Google spreadsheet, several rows (cells) of which have already been filled with a limited number of strings, let's say for simplicity "January", "February", "March", etc.
I would like to format the column such that, when entering text in new (empty) cells, rather than having to type the text from scratch, I instead get to choose from a drop-down list populated with the strings that already exist in other cells of that column (all 12 months, in the example above).
Or, alternatively, to have an auto-complete that would suggest, say, "March" and "May", once I start typing "M". Strangely, I haven't seen this basic feature at work in GSheets for a while, even though the EnableAutocomplete option is checked in the menu.
Among the two options, I would prefer the one with the drop-down list over the autocomplete one, but ultimately either would be of massive help. The idea is, once the number of unique strings becomes high (but there is also a lot of repetition), to reduce the chance of making a typo when entering new values just because they happen to differ by one letter from a string that already exists elsewhere.
Is there a way to do this just via the GUI/addons? I know this is possible to do in Excel for the header row (screenshot below), but I don't know of a way to do that also in GSheets, and in either case, what I need is to have this sort of selection list at the cell- rather than at the header-row level.
what you are looking for is called Data Validation:
and you can select various options for criteria

Qlikview selection to work on multiple fields

I have three different tables that contain a similar field ('Department') meaning the possible values in each of them are exactly the same. I have a sheet that shows different objects let's say charts, line graphs, straight table etc based on table 1, 2 or 3. Now because the tables are not directly connected, I can't just have a listbox that selects works on all of them for that column. I want to have a single selection like a listbox based on one of them but a selection is made is like show me all possible values where
Field A = Field B = Field C and on deselect i want to have the same behaviour
Probably I will have to use macros but I am not finding any good guidance.
For this case you can use the set analysis p() function.
For example if your fields are named Department and Department1. Then you have have your listbox based on Department field and in the charts where is needed Department1 selection you can write expression like this:
sum( {< Department1 = p( Department ) >} Value)
This will show sum( Value ) where selected/possible values in Department are equal to Department1
As of the macros - they should be your really, really final solution and try to avoid them. They dont work on 100% when the document is published on the server and they are single threaded, which can lead to performance issues with your app.

Dynamic Search Boxes in Jquery Mobile

Am not sure on how to do this but I will describe it and hopefully you all can come up with a good solution. I want to have a box (not sure if its an input of search box) that when someone types in the box it pulls values from my database and shows the closest match based on characters being typed in. If the word that is typed by the user is not there then when the form is submitted then the word is added to a database.
Additionally I want to have an add button next to the box, so that if the user wants to add more than one word they can. This means that when the add is clicked a duplicate of the first box appears which does the same thing. The values will be stored in an array.
Any idea how I can go about doing this?

Automatically updating Data Validation lists based on user input

I have a very large data set (about 16k rows). I have 10 higher level blocks and within each block I have 4 categories (10 rows for each) which use Data Validation lists to show items available in each category. The lists should automatically update based on user input. What I need your help with is that I want to use the same data set for each block and preferably a least calculation/size intensive approach. I have put together a sample file that outlines the issue with examples.
Sample File
Thank you for your help in advance.
Okay, I've found something, but it can be quite time consuming to do.
Select each range of cells. For instance, for the first one, select B3:B18 and right click on the selection. Find 'Name a Range..." and give it the name "_FIN_CNY". Repeat for all the other ranges, changing the name where necessary.
Select the first range of cells to get the data validation, and click on "Data validation", pick the option "Allow: List" (you already have it) and then in the source, put the formula:
=INDIRECT($G$4&"_CNY")
$G$4 is where the user will input. This changes as you change blocks.
_CNY is the category. Change it to _CNY2 for the second category.
Click "OK" and this should be it. Repeat for the other categories.
I have put an updated file on dropbox where you can see I already did it for the data of _FIN for categories CNY, CNY2 and INT and did the one for _GER as well. You'll notice the category of INT for _GER doesn't work, that's because the Named Range _GER_INT doesn't exist yet.

Resources