Logic issue, adding Buttons to UI based on database entries [closed] - iphone

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
In my SQLite database (FMDB) i have some attributes as listed below;
Module | Student1 | Student2 | Student3 | Student4 | Student5
One Module may have a minimum of 2 students and a maximum of 5 students. So based on the number of students i have to display Buttons.
If the number of student are 3, then i should display 3 buttons. For Ex : if the database entry is as
Science | jack | Tom | - | Debra | -
note that the - sign is an empty record. So if we come across a entry with - sign we have to ignore it. So according to the above query we have 3 students and we should display 3 buttons. (If there were 4 students we should display 4 buttons and etc...)
How could i read the values from the database, and base on that answer add buttons to the UI ?
note: I don't have any proper code to demonstrate my working. I am lost in this.

Ok, So first learn about interacting with with a SQLite FMDB Here
Then, create some kind of for loop combining the code from here and here to create UIButtons and add them to an array, then displaying only the UIButtons in the array.
The positioning of the buttons onscreen is just a bit of simple math.

Related

If you have a data object with large features (100+), is it better to expand this data by adding columns or by storing it in row format? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
So, if you can imagine a person was simultaneously enrolled in 100 different courses and had just received final grades for all courses, would it be better practice to store that information like so (wide columns):
personID
Math
Science
English
1
90
88
98
2
91
98
90
(and ...97 other columns)
Or like this:
personID
Grade
Subject
1
90
Math
1
88
Science
1
98
English
This brings the columns down significantly (from 100 to 3).
creating 100+ columns on any table is always bad idea. there is limit on no of columns in any database.
read this to get better idea. as you can think of following way.
StudentsMarkDetails
StudentsMarkDetailsID
personID
SubjectId
MarksObtained
ExamID
1
1
3
64
1
2
2
4
36
1
3
1
4
36
2
SubjectMaster
SubjectId
SubjectName
1
Maths
2
Science
3
English
Definitely option two - few fixed number of columns.
The reasons are many. Here’s a few:
maintenance: if you have 100 columns now, tomorrow you’ll have 101. Adding a column requires a schema change, which is painful
access: to get a value, you need to code the column name. This a form of maintenance problem in the code that accesses it, be it queries or app code
queries: basic queries become impossible. Write the query that returns the average grade for a student and the problem will be immediately obvious
Here are two solid rules I made for myself that I never break:
Prefer more rows over more columns.
Prefer more columns over more tables.
It is better to store the data with one row per person and per course. Why? Here are some reasons:
Different people may have different courses.
Most databases have a limit on the number of columns in a table.
You may want to store additional information per score, such as the date/time it was entered.
It is easy to add new courses or to change existing scores, if necessary.

adding weekends and excluding working days [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How can I create a calculated field in Tableau that shows me the following;
it should exclude weekdays working hours between 08:00 am-16:00pm
It should include full weekends.
Trying to find who is login to the system after working hours.
Thanks a lot,
Assuming that you want to flag unauthorised logins, I have done it like that-
Sample data I have used-
Calculated field unauth_login like this
DATEPART('iso-weekday', [Login_time]) >5
OR
DATEPART('hour', [Login_time])>=16
OR
DATEPART('hour', [Login_time])<8
and you will your desired results with yes values flagged separately from no. Screenshot
Do tell me whether I got you correct?
Assumption: Saturday and Sunday are weekends are in your country/locale.

Column to Row transpose in Talend [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to get a crosstable operation by using Talend Open studio.
My Source is like:
id 201601 201602 201603 ...
1 aa bb cc ...
I want to get the output like below:
id date value
1 201601 aa
1 201602 bb
1 201603 cc
. . .
. . .
. . .
Column name is depend on date. So I need a automatic way to convert columns into rows.
You may use tSplitRow.
See the capture with the job, tSplitRow configura and schema.
I think you can try with tUnpivotRow component. However you need to know this is custom component created by community member daztop.
Component is avalaible to download from this link.
Under this link you will find instruction how to use this component.
Also if your data are stored in database you can transpose columns to rows direclty in that database by running proper sql query via talend (query depends from databse engine).

Save a ordering list of data into core data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
i have an nstableview, where the user can add rows.
each row will directly save into Core data.
at the moment i can request the records of core data and sort it by objects id to get the correct order, because the object id is nearly the same like an incremental number.
but now the user can reorder the rows.
how can i save this new order of rows into core data?
Using the id as a way to order is not guaranteed to work, so you shouldn't do that.
Instead, add a field that represents the order.
What we do is have a field called pos that is in integer and we set it sparsely. The first record can be 100, the second 200, etc. Then when we re-order, we set pos to the mid-point of the records right before and after. Every once in a while, you need to re-number the records. The more sparse you do it, the less you need to re-number.
When you add a new record set it to the max value + 100 (or whatever spacing you are using)

Merge multiple google spreadsheet columns into one column [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
In a google spreadsheet, I have 2 columns of data. I'd like to merge them into another column. The data on column 1 is not as the same as column 2 (data that is present in column 1 but not in column 2). I would like to merge them to create a single column of information containing no multiple data, complete list of column 1 and 2 to column 3.
Expected Result:
Column 1
Apple
Banana
Cashew
Watermelon
Column 2
Apple
Banana
Strawberry
Mango
Column 3
Apple
Banana
Cashew
Watermelon
Strawberry
Mango
List of fruits in column 1 and 2 are not exactly the same and it is all listed in column 3 without duplicate fruit name result.
does this formula work as you want in column C:
=UNIQUE({A:A;B:B})
You can use cell function - CONCATENATE.
e.g. cell A1 contains data "Name", cell B1 contains data "Suffix" then in C1 you can use functions as =CONCATENATE(A1,B1) this will give NAMESuffix in cell C1.