The crux of the problem is this:
I have a Schema that will later be converted to a .csv file. However, I need to populate this schema with data. To do this, I need columns that will have fields (Name, data type, order, etc.)
But I don't know how many columns the Schema will have
Therefore, the wording sounds like this: Create a form with a dynamic number of columns.
While I was writing the question, I had an idea to create a "Scheme" table in the database and bind a table - "Column" to it
Thus, when you click "add column", a new instance will appear that will already be bound to this Schema.
Am I thinking in the right direction or do you have another idea?
The picture below will allow you to convey the essence of the problem more accurately.
Thank you in advance
If I was in your position, I would utilize HTMX. With that, when the "add column" button would be pressed, a new row would appear.
I would also do it the other way around from what I understand of your post, I would bind the column to the scheme like this
class Scheme(models.Model):
...
# rows of scheme
class Column(models.Model):
scheme = models.ForeignKey(scheme, models.CASCADE)
...
# rows of column
Related
We are creating several charts in superset and with the partition type chart the ORDER BY seems to be hard coded and we cannot change it. The goal is too have the months on the left in the correct order (the column in this case is Month). When run in sql lab it works in correct order but in the chart view we cannot change the ordering
Any suggestions?
I assume you mean the dates on the right here?
I work with superset and I have experienced this limitation that does appear to be hard-coded into the ordering once a chart is made. I would suggest if it wasn't too much hassle to add another column to your database of the text value and follow the patter of;
WHERE "Month" = 'January' SET "OrderingColumn" = 'A'
WHERE "Month" = 'February' SET "OrderingColumn" = 'B'
etc etc
Then in your charts you can try: ORDER BY "OrderingColumn"
It is a bit of an inconvenience but if you are able to manipulate your data by changing tables or views this seems to be a solution you could use.
I hope this may be useful even to change the way of approaching the problem.
I'm running SharePoint Online 2013. I've set up a document library. The default "Add Document" form contained many fields irrelevant to some users, so I've got a requirement to add another "Add document" form with shorter list of fields to fill in. I've added a new content type with fewer columns. The columns share names with parent content type, Document. Now I would like to do the following:
1. Move data from the original Document content type columns to the new content type columns with identical names
2. Delete old columns
3. Redefine all views to point to new columns.
Question 1: is it possible to do? Can documents in library have some columns from one content type and other columns from another? Can views display data from two content types?
Question 2: If q1 answer is 'yes', how can I move data from the old columns to the new columns? I tried to follow suggestion here: How to copy values from one column to another and set up workflow in SharePoint Designer, using "Set Field in Current Item" action in Reusable Workflow, but the Field drop-down box only lists one filed, Title, to pick from. What am I doing wrong?
If q1 answer is 'no', what can be done to resolve this?
Thank you.
Answer 1 : No, a document is bind to a content type. Yes, a view can display columns from different content types.
In your scenario, I would create the new content type then :
Copy the initial document
Bind this new document to the new content type.
Get the columns data of the old document and set this data to the columns of the new document.
Delete the old document
After you make sure your old content type isn't use anymore. You should be able to delete him.
(Make sure you clean all the recycle bin before delete the content type. Otherwise, you'll get an error.)
Pardon the dumb question, but where can I find a view for Django to display "tables" in a spreadsheet-like format (i.e. one record per row, one field per column).
(The fact that I have not been able to find one after some searching tells me that maybe my noob-level understanding of Django views is way off-base.)
Here I'm intending the term "table" fairly generically; basically, think of a table as an "list of lists", with the additional constraint that all the internal lists have the same length.
(It would be great if this table had spreadsheet features, such as the possibility of sorting the rows by clicking on the column headers, or of cutting and pasting arbitrary rectangular subsets of the cells, but I realize that this may be hoping for too much.)
An other way to do it is to use tabular inlines but a list view is what you are looking for.
I pretty new to APEX and I'm having a bit of trouble working with my first Tabular form. The table I've linked it to is fairly simple. The columns are as follows:
Primary key representing an internal
code for a college major
Foreign key representing the "real"
code for the college major
Description for the college major
The user that inserted/updated the
row in the table
The date the row was inserted/updated
At the moment, I'm facing two problems.
I want the user to be able to specify their own primary key for the row but not to be able to change any existing primary keys. When I specify the column type as "Text Field" users are able to edit existing rows' primary keys and it also seems to break the report when trying to add a new row as I get a checksum error.
I would like the user and date
columns to default to the currently
logged in user and the current date,
but specifying default values for
either of these columns also seems
to cause syntax/SQL errors. Does
anyone have any examples of how to
use the default value functionality
for a column? Fixed. I can just use SYSDATE as a value on it's own when specifying the PL/SQL type for default. Username can be obtained through functions in APEX_UTIL
Perhaps you could use 2 conditional fields. If the field value is null, display the edit box, if the field value is not null display the display-only field.
I have a model which represents the user's display preferences. Just about all of these preferences are boolean values. Instead of having 50 boolean columns, is there a better way to go about this? In the future when I want to add a new item, I don't want to have to add a new column in my database.
If you have that many booleans and are anticipating adding more, you should not be using columns, but entries.
Then when you need to look up "User wants emails", just search for UserPrefs.objects.get(User=user, Preference=Preferences.objects.get(name="wants email")).
User_Table:
User
username
etc
Preferences_Table:
name
description
etc
UserPreferences_Table:
User (FK_User)
Preference (FK_Preferences)
Setting (Boolean)
Depending on your setup, you may be able to omit the Setting field in the UserPreferences table and simply use the existence of an entry for that User/Preference as a True and the lack of one as a False.
You could also use a bitmap. You only need single char field in you database. Somewhere in your app you store a list of preferences, pref1, pref2, pref3 ... and in the bitmap filed you store a sequence of 1's and 0's that correspond to the preferences.
For example 101 means pref1=yes, pref2=no, and pref3=yes and 011 means pref1=no, pref2=yes, and pref3=yes.
You could make this reusable by creating a new model field type for bitmaps.
" In the future when I want to add a new item, I don't want to have to add a new column in my database."
In this case, you'll want to add a row.
You have a table with the domain of possible setting Names. 50 rows.
You have a table of actual settings. User, Setting Name, Setting Value.