json formatting – How to display past list items related to a column value?

I have the following SharePoint list in which the “Participant” columns are text values (names of people) and each item in this list is a training event. “Evenement” is the type of training and “Jour” means day of the training.

What I need to do is whenever someone hovers on the name of a participant – I need their past training events to show.
For example if “Participant 1” is Alpha and his “Jour 1” is on 11-05-2021 then “Jour 2” is on 12-05-2021 and “Jour 3” is 13-05-2021 and finally “Jour 4” is 14-05-2021. I need all this information to show on a hovercard if possible?

I am not sure if this makes complete sense or not and if it’s even possible but any guidance would be appreciated, thank you in advance to anyone who replies and please be advised I’m only starting with JSON .

Sharepoint List Preview

How do I apply more than one conditional formatting rule using JSON to a SP Online List column?

You cannot apply multiple JSON formatting codes to single column. So, you have to manage multiple conditions/rules within same JSON.

For changing color to red when number is negative, add below code in your existing JSON:

...

"style": {
      "color": "=if(@currentField < 0, 'red', '#323130')"
}

...

Documentation: Use column formatting to customize SharePoint

Update new column with previous column value

I have one table with 3 columns id,name,new_column So my requirement is to add name column values to new_column but if namae column have duplicate values then in new_column values should be combination of id+name values

Table structure

id  name   new_name (empty column)

1  aaa
2  bbb
3  ccc
4  ddd
5  aaa
6  eee
7  ccc

Now expected output

id name new_name (empty column)

1  aaa     aaa
2  bbb     bbb
3  ccc     ccc     
4  ddd     ddd
5  aaa     5aaa (due to duplicate value id + name )
6  eee     eee
7  ccc     7ccc (due to duplicate value id + name )

sharepoint online – How do we vertically delete values from a single column?

Within a SharePoint Online list, there are options to either enter and exit out of Grid view to select and edit various parts of a list in a grid like fashion.

I see I can use my mouse to select, pull, and drag in order to select multiple row values from a single column.

My list example

Column A | Column B | Column C
value1
value2
value3
etc...

But, how do we bulk delete all values from a single column and still keep the column?

In my example above its, value1, value2 …. value1000.

sharepoint online – SPO: Using JSON to Show/Hide Modern Form Field Based on Value Selected in Lookup Column

I am trying to modify the new-entry form of a modern list in SharePoint Online by hiding or showing a field based on the value selected in a preceding field on the same form. Microsoft offers straightforward guidance on how to do this using a JSON snippet.

While they don’t list a lookup column as an unsupported field type to use for this purpose, they don’t provide guidance on how to use one in this way, either. And from my testing, you can’t simply grab the value of a lookup field in the described way:

=if(($LookupField)=='Hourly', 'true', 'false')

If I use a choice field instead of a lookup field, this works fine. But doing some digging, in other contexts it looks like the value may be captured in a .lookupValue property, so I tried it this way:

=if(($LookupField.lookupValue)=='Hourly', 'true', 'false')

Still no luck. Does anyone know if it is possible to use the value from a lookup field in this way? And if so, what do I need to do to make the magic happen?

What is best practice for referencing data rows within stored procedures – via PK, code column or data value?

Suppose you have a table for colours with columns:

  • id = automatically incrementing integer, primary key
  • code = short code reference for the colour, unique
  • colour = human-readable name of colour, unique

Example values might be:

Now imagine you have a stored procedure that, at some point, needs to reference this table. Let’s say the business logic says to obtain the colour “Green”. To achieve this, you could have any of the following three WHERE clauses:

  • WHERE id = 2
  • WHERE code = GR
  • WHERE colour = Green

Now, if the system is designed such that it is agreed that a code value, once created, never changes, then, in my view, that is the best column to reference because:

  • It is an alternate key
  • It is human-readable for people who maintain the code
  • It will not be impacted when the business decides to change the colour value to ‘Sea Green’

However, if a legacy table lacks such code values, what, in your opinion, is best practice? To reference the id column, or the colour column?

If you reference the id column, the code is not readable unless you then also add comments – you shouldn’t have to comment simple things like this. It sucks figuring out what statements like WHERE id not in (1, 7, 17, 24, 56) mean.

I’m not sure how often, in reality, the id value might change – but consider if you run a script during development to insert new colours but then delete those and insert some more. If your stored procedure references the id values from that last set of colours inserted but when you create your new colours in your next environment you skip the step that inserted the colours which ended up deleted, then the id values won’t match in that next environment. Bad practice, but it can happen – a developer develops their script on a dev instance not thinking that the id values will conflict with production (which, for example, may have had additional colours created manually by the business before your colour creation script runs).

If you reference the colour column, you run the risk that if the business does ask to update the description from ‘Green’ to ‘Sea Green’, that your procedure will begin to fail.

I suppose a further solution is to implement the code column when you need it, if it isn’t there already – probably the best solution?

postgresql – How do I add a where statement at the end of query for a column that does not have a table to reference from?

Use the WITH clause to get the result set and SELECT only the wanted rows.

WITH CTE As (
select
CASE WHEN (to_char(((case when v.trip_order_start_date is null then case when v.manual_start_date is null then t.required_pickup_date else v.trip_order_start_date end else v.trip_order_start_date end  + (interval  '-1 hours' * ofc.offset)) at time zone 'utc' at time zone 'America/Chicago' + (interval  '-1 hours' * ofc.offset)) at time zone 'utc' at time zone 'America/Chicago', 'YYYYMM') < to_char((now() at time zone 'utc' at time zone 'America/Chicago'), 'YYYYMM')
        AND(coalesce(posted_date, paid_date) IS NULL
            OR to_char((coalesce(v.posted_date, v.paid_date) + (interval  '-1 hours' * ofc.offset)) at time zone 'utc' at time zone 'America/Chicago', 'YYYYMM') > to_char((now() at time zone 'utc' at time zone 'America/Chicago' - interval '1' month), 'YYYYMM'))) THEN 'YES' ELSE 'NO' END AS accrual
) 
SELECT * FROM CTE WHERE accrual = 'YES'

Or use the SELECT query as SUBSECT in a FROM clause and use that

SELECT * FROM (
    select
    CASE WHEN (to_char(((case when v.trip_order_start_date is null then case when v.manual_start_date is null then t.required_pickup_date else v.trip_order_start_date end else v.trip_order_start_date end  + (interval  '-1 hours' * ofc.offset)) at time zone 'utc' at time zone 'America/Chicago' + (interval  '-1 hours' * ofc.offset)) at time zone 'utc' at time zone 'America/Chicago', 'YYYYMM') < to_char((now() at time zone 'utc' at time zone 'America/Chicago'), 'YYYYMM')
            AND(coalesce(posted_date, paid_date) IS NULL
                OR to_char((coalesce(v.posted_date, v.paid_date) + (interval  '-1 hours' * ofc.offset)) at time zone 'utc' at time zone 'America/Chicago', 'YYYYMM') > to_char((now() at time zone 'utc' at time zone 'America/Chicago' - interval '1' month), 'YYYYMM'))) THEN 'YES' ELSE 'NO' END AS accrual
    ) t1 
WHERE accrual = 'YES'

In both cases you need a valid SELECT

powershell – How to update the value of a choice/multichoice column in Sharepoint online through coding

Is there a way through using a piece of code to update all the specific values of a column of SharePoint online to something else?

I am looking for an equivalent of the below SQL code for Sharepoint online

udate list1 set att1='Region2' where att1='RegionB' and att2='True'

Do we need to have a different piece of code for choice/multichoice column?

Does the code need to iterate through every single record?

If there is a way, I assume before doing this operation we need to turn all the flows of this list which are triggered by update/insert off, If this correct, Is there a way to avoid or shut down these flows through code or turning them off should be done manually?

Get the last three values of column in Google Sheets

I need to create a report that pulls the last 3 cell values in a column.

This will need to be in three separate cells.

Column C will contain data which will be added to daily.

  • D2 will contain the value of the last but 2 cell in column C.
  • D3 will contain the value of the last but 1 cell in column C.
  • D4 will contain the value of the last cell in column C.

Note : I’m using Google Sheets.

Any help will be greatly appreciated.

CONDITIONAL FORMATTING – Unable to format column

I have a SharePoint LIST that’s being used to manage events. There are 6 participants for each event and each Participant has a column:

“Participant 1”, “Participant 2”, “Participant 3”, “Participant 4”, “Participant 5”, “Participant 6”

I need the FILL color of Participant 1-3 to be Green if EMPTY and Transparent if NOT EMPTY
I need the FILL color of Participant 4-6 to be YELLOW if EMPTY and Transparent if NOT EMPTY

I have been able to accomplish the above – my issue is that the “($Evenement)” column has two choices; Orientation/Formation. If the selected choice is Orientation – I need the Participant 4/5 columns to have GREEN fill IF EMPTY and Transparent if NOT EMPTY. Below is the code that’s not working for what I need. Any help would be appreciated – I am a complete newbie to JSON.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if(@currentField == '', '#98FB98', if(@currentField == 'blocked', '#FF6A6A', if(($Evenement) == 'Orientation', '#FFFF66', '')))"
  }
}