Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Glyndwr Bartlett

Ranch Hand
+ Follow
since Jul 30, 2018
I am not a programmer. I am learning as I go in order to create an award application for Scouts.
Australia
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
11
Received in last 30 days
0
Total given
26
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Glyndwr Bartlett

I figured out how to keep the "Name" cell on top"



Still need to figure out how to fix my main issue of keeping the table within the screen / page boundaries.
I have a large table that is scrolling on the horizontal and vertical with the first column sticky and the three header rows sticky. This works to a point. However the table extends past the right side of the screen and I would like it to remain in the boundaries of the screen.

The other issue is that the Name heading is behind the list of names when scrolled down (this does not happen in the attached jfiddle); however, it it remains visible if I only scroll right.

When I add this css:



The table is within the boundary of the screen; however the sticky on the heading rows does not work.

Please see my attempt at a jfiddle; however, I can not get the Bootstrap to work (I included the cdns).

My jsfiddle

My aim is to have the:

  • Table stay within the boundaries of the screen
  • Top heading rows and left column stick when I scroll
  • Name heading remain in front when I scroll down and right
  • Hi Paul,

    Yes, I do use MySQL Workbench and have been hacking away at this. Eventually I just replaced NULL with '' and it now works. So, for some reason, if one of the CONCAT statements returns NULL then the whole string is NULL. So, do not use NULL in a CONCAT statement.

    Kind regards,

    Glyn
    I am very sorry to lead you down the wrong path. This is a prepared statement; not a stored procedure. I got my terminology mixed up.

    This is MySQL and I do not think that the fact I am using java is relevant. As long as I can get the MySQL to produce the correct output then the rest will follow (i.e., I am passing lots of other information without any issues).  The following code, as I stated, works in producing a simgle css name:

                                 

    Produces the cssString of cssItalic. And this works. However, I want to be able to pass more than one css name to the client side. For this to work the client side needs to receive the css names in square brackets, quotes and separated by commas, e.g.,:



    To achieve this I have tired:



    And:



    I am using prepared statements for security reasons (e.g., prevent SQL injection).
    Hi Tim,

    I did try LIKE '%C%', etc and that did not resolve the issue.

    Kind regards,

    Glyn
    Hi Tim,

    I am very open to a better way of forming the query if you have one :-).

    The line




    Works perfectly well so I do not think the LIKE not having operators is an issue.

    Kind regards,

    Glyn
    Hi Campbell,

    Yes, the cssString is returning null. I have  System.out.println("cssString: " + result.getString("cssString")); to show what is in cssString.

    Kind regards,

    Glyn


    In the while statement System.out.println("cssString: " + result.getString("cssString")); is null:


    Hi Paul,

    It is the posted code. As explained there are are two examples that try to produce the some result. The full code is:

                           


    And the second example:

                         

    I am trying to produce an output row from a MySQL stored procedure using IF and CONCAT. However it returns null. I have tried two methods and a backup method, that works, to prove the data is valid. I am expecting the following to be returned:



    Method 1:



    Method 2:



    Proof Method (this returns - cssItalic):

    Thank you so much Carey. It will take me some time to understand this code as I am not very proficient.

    Kind regards,

    Glyn
    4 months ago
    Hi Carey,

    Thank you so much. You are right. There should be only one line checking the stt date "AND stt_end_date IS NULL || stt_end_date > ? " where ? is today's date.

    Kind regards,

    Glyn
    4 months ago
    Only one SQL query required and that works, so no need to change the SQL. I provided the SQL for information only.

    I have given two examples of what the SQL can return with an example of the output of the code that operates on it.  I will explain it in another way.

    The fields returned are:



    The first example returned by the SQL is:



    The code run against this data is run on a Tuesday so needs to return:



    Another example is that the SQL returns:



    The code run against this data is run on a Tuesday so needs to return:

    Wed, N, Thu, Y, Fri, N, Sat, Y, Sun, N, Mon, Y, Tue, N

    I suppose a third example would be if we have three start and end:



    The code run against this data is run on a Tuesday so needs to return:



    The design is:
  • Determine the start date (in this example the code is run on a Tuesday so the first day returned is a Wednesday)
  • Return each day and Y/N until the end date on the row is reached

  • In the first example there is only one row without an end date so read stt_wednesday N, stt_thursday Y, stt_friday Y, stt_saturday N, stt_sunday N, stt_monday N, stt_tuesday Y

    In the second example there are two rows with end/start dates that are equal so from the first row read stt_wednesday N, stt_thursday Y. Friday is on the 31/12/2021 which is the end date of this row so read the next row. The next row starts on the 31/12/2021 and has no end date so read  stt_friday N, stt_saturday Y, stt_sunday N, stt_monday Y, stt_tuesday N

    In the third example there are three rows with end/start dates equal so from the first row read stt_wednesday N, stt_thursday Y. Friday is on the 31/12/2021 which is the end date of this row so read the next row.
    The next row starts on the 31/12/2021 and has an end date or 02/01/2022 so read stt_friday N, stt_saturday Y, . Sunday is on the 02/01/2022 which is the end date so read the next row.
    The next row starts on 02/01/2022 and has no end date so read stt_sunday N, stt_monday Y, stt_tuesday N.

    In this example:
  • The program was run on a Tuesday so the returned start date was a Wednesday; however, the program can be run on any day.
  • The end date of one row was the same date as the start date of the next row. It is possible that the next start date could start later. Therefore, any days between the end date and start date are assigned "N". For example Row has an end date of 31/12/2021 (Friday) the next row has a start date of 03/01/2021 (Monday). Therefore, Friday, Saturday and Sunday are assigned "N" each and the Monday and Tuesday are assigned the values returned in the row (stt_monday and stt_tuesday).


  • I hope I have explained it as clearly as possible. This is very complicated which I why I am requesting help (I am not the smartest person in the room).

    Kind regards,

    Glyn
    4 months ago
    The trouble is that I have not been able to work out anything that makes sense. However, this is what I have:





    Still very rough; however, working on it. Any help would be appreciated.

    Kind regards,

    Glyn
    4 months ago
    I have a requirement to show a person's appointments for the next seven days. So if today is Tuesday I need to show Wednesday to Tuesday.

    The table I am sourcing has the patient's recurring appointments with:
  • Start date
  • End date (if null does not end)
  • sunday (Y or N)
  • monday (Y or N)
  • tuesday (Y or N)
  • wednesday (Y or N)
  • thursday (Y or N)
  • friday (Y or N)
  • saturday (Y or N)


  • So the extract on a Tuesday 28/12/2021 could have:
  • 2020-10-28
  • null
  • N
  • N
  • Y
  • N
  • Y
  • Y
  • N

  • The output would be:
  • Wed - N
  • Thu - Y
  • Fri - Y
  • Sat - N
  • Sun - N
  • Mon - N
  • Tue - Y


  • However, if there is an end date (end date is exclusive) and a new series starts then I could have:
  • 2020-10-28
  • 2021-12-31
  • N
  • N
  • Y
  • N
  • Y
  • Y
  • N
  • 2021-12-31
  • null
  • N
  • Y
  • N
  • N
  • N
  • N
  • Y

  • The output would be:
  • Wed - N
  • Thu - Y
  • Fri - N
  • Sat - Y
  • Sun - N
  • Mon - Y
  • Tue - N


  • I am using a while (result.next()){...} to get each row returned. I am having difficulty in working out the logic within this while loop to return the required results.

    Kind regards,

    Glyn
    4 months ago