JSF-2.0 - specific row's(eg: 1st row) column value (eg: 2nd column of a row) need to be changed on change of other column value (eg: 1st column of a row)
I don't know if it is your question but if I understand correctly you probably could render the other column contents based on their id's. I do though think that you need the whole id of the rendered component including the row number of the id. Otherwise just render the whole table.
PLease confirm if this was the question and if this actually functions...
Related
In a Google Sheets database, I have a formula which I have built in order to allocate a reference number to a series of companies.
Each company should have its unique number in the form of RET00XX where XX will represent the unique company number. I would like these numbers to be sequential, starting on 1 and going on +1 after that.
Whenever a new company is inserted in the database, the formula should be able to attribute it a reference number. It should also be able to verify if the company already exists in the database and, if so, automatically attribute it the company's unique reference number, instead of creating a new one.
The company names are in cells of column B.
This is the formula I have built (an example of the one in row 2):
=ARRAYFORMULA(IF($B2<>"",IF((COUNTIF($B$1:$B1,$B2)>0),INDEX($A$1:$R2,MATCH($B2,$B$1:$B1,0),12),CONCATENATE("RET00",ROW($B2))),""))
The steps it takes are:
It verifies that column B in the correspondent row is not empty;
With the COUNTIF function, verifies that the company does not exist in any of the previous rows;
If the company does exist, it attributes the correspondent reference number through the INDEX function;
If the company doesn't exist, it attributes the company a new reference number with the CONCATENATE and ROW functions.
The formula is largely working, although there are some problems.
Users adding to this database have the habit of adding entries by inserting rows in the middle of the database. This makes it so, due to the way the formula is built, that company unique reference codes change each time that happens. I believe this is partially due to the fact that I use a ROW function. Also, given that new rows are inserted in the middle of the database, the formula should be able to verify is the company already exists not only by looping through all previous rows but rather through all rows (if a new row is inserted, the formula will only verify previous rows, when the company could be in the rows after the new one).
How can I attribute sequential numbers in a formula without reference to ROW? Also, how can I make sure that the spreadsheet verifies for all rows of column B instead of just the ones before the inserted row?
apply this formula in your sheets,
=ArrayFormula(if(B2:B<>"",row(A2:A)-1,""))
More information regarding this please visit this link : https://infoinspired.com/google-docs/spreadsheet/auto-serial-numbering-in-google-sheets/
Solution that is independent of starting row number
These examples will allow you to generate incrementing values in your formulas.
Incrementing integers, zero based:
The values will be: 0,1,2,3, etc.
Note: The address "$A$2" represents the cell of your top row. It should be changed to whatever cell your actual top row is. The nice thing about this method is it it will not break if you insert new rows above the start position of your formula.
=(ROW()-ROW($A$2))
Integers, one based:
The values will be: 1,2,3,4, etc.
=(ROW()-ROW($A$2) + 1)
Dates:
The values will be: 2000-01-01,2000-01-02,2000-01-03, etc.
=Date(2000,1,1) + (ROW()-ROW($A$2))
All Even Numbers:
The values will be: 0,2,4, etc.
=(ROW()-ROW($A$2) * 2
Short answer
Use Google Apps Script
Explanation
Using spreadsheet functions to set an ID on a live spreadsheet used as a database is very risky as the values will be recalculated when changes be made to the spreadsheet content.
Instead of using a formula use a script to add a "fixed value". Scripts could be called automatically on events like cell edits and row insertion, by using a custom menu or side panel, from the script editor or by time-driven triggers.
The following Q&A from Web Applications shows several ways to set a sequential number:
Can I add an autoincrement field to a Google Spreadsheet based on a Google Form?
This other from SO could be helpful too:
Auto incrementing Job Reference
Insert 1 in the first cell and paste the formula below in the following cells.
=INDIRECT(ADDRESS(ROW()-1,COLUMN())) + 1
Add number on very first row and type the formula from next cell
i used =A1+1 to get incremental number to index tasks on each line.
I have a number field called Days and an editable names field called Names ( which allows multiple values ).
Let say that Days=1 and Names=Mike/Rock, Tom/Rock, Dean/Rock.
I want to display them in a column view like this:
1
Mike
Tom
Dean
I tried it with #NewLine, but no luck for me.
I also created a computed (hidden) field test with the following formula as default value:
#Text(Days)+#NewLine+#Implode(#Name([CN];Names);#NewLine)
It seems to be the wanted form for me, but when I just put test in a column default value, it shows nothing.
I appreciate your time.
Try to set your test field to #text(days):Names. This should create a multi-value field (as opposed to a single string which your test formula produces).
Then, set the multi-value separator of the column style to Newline, and adjust the number of rows to match the expected number of values.
In a view we get only one row for one document. Multiple values are therefore shown in one row only with multi value separator.
Eclipse view may perhaps help.
I have a table of names. They are ordered randomly. I would like to highlight the name which has the latest created_at value by adding a class to its table row. So far I came up with creating an invisible column with hidden created_at values and then jQuerying the needed row, but it doesn't sound so good.
A better solution, perhaps?
Edit 1: actually, I would like to highlight the latest added entry for a certain amount of time, ideally only after the name was added. On the next reload/visit all of the rows have to be identically styled.
What about adding a data attribute to each row with the created_at value and then jQuerying the needed row?
<tr data-created-at="#{<%= object.created_at %>}">...</tr>
That way you don't need an additional invisible column, hope this helps
In an SQLite table in my app, I need to have a column with row numbers going 1,2,3,4,5 (or to be able to get a row number for every row). Now I delete rows and add rows all the time, so I cant just put a number every time I add a new row, because when rows are deleted, the numbering will get messed up. So is there a way to get the row number, or create a special column that will act as row numbering? If so, how?
If you want this to be reset every time you add and delete rows, should this really be a column in your table?
For example, if you just want to be able to select the 20th row from the table, you can use the LIMIT and OFFSET clauses of SQL to select a particular row, e.g., to retrieve the 20th row from my news table, I could do:
SELECT * FROM news LIMIT 1 OFFSET 19;
Alternatively, if you really want a column with this row number information, you could just add a new INTEGER column type and then write an Objective C method to update the values for that column, and invoke that method any time you delete or insert rows in your result set.
There are a number of ways of solving your problem. You have to explain what you're trying to accomplish for us to help you out. The typical AUTOINCREMENT answer is what we generally use for table keys, but it sounds like you don't want this to be the key of your table, but rather something else.
If you use ROWID which is an auto-incrementing number, you can compute row numbers by selecting all of your data, ordered by ROWID and then using their index in the returned results as their row number. If you have some data model class you're creating, you could pass that in to its initializer.
If that won't do what you want, then how about adding some more details about what you're trying to do. Are you sure you need a row number?
You don't want to go changing all the existing records in your database when you delete rows that make "holes" in your row-umber scheme.
SQLite already supports what you want, with the ROWID. When you make a select query, just specify it to sort on ROWID, and all your returned records will be sorted in their proper order, and you can iterate over them in their order.
See this page: http://www.sqlite.org/autoinc.html
FWIW, there are certainly places where you should prefer direct SQLite over Core Data. However, those are rare cases. In general, reach for Core Data first, and fall back to SQLite only when CD does not serve your needs.
Just use an autoincrement primary key for the table. then there is always a unique identifier you can access a record.
I am new to PowerBuilder and I need to add a new column to a DataObject. The DataObject has several fields which retrieves data using select statement. So if I add a column in the select statement I get another field with a name compute_0041 along with the added column field. When i try to remove the compute_0041 field I cannot see any value in the field representing a new column. How do I remove the compute_0041 that gets automatically added?
Thanks
In Datawindow if you accidentally put a 0 or '' in one of the rows in the tab called Computed Columns then these columns may come in. Of course, you can also have a computed column yourself by specifying it there but since it seems you think you didnt do anything and it came up on its own it appears to be an accidental issue.
You can of course check for it by going to the SQL mode and checking for it there. Also, the last tab in the design view it shows the complete generated SQL where you can easily see a select column that is not chosen by you.
Hope the above will aid you to identify the issue. Please let me know if you still have the issue.