How to format Sharepoint Lookup Column Additional Fields

Multi-Lookup fields (more than one lookup value) can be formatted. The values come back as an array which lets us use the advanced formatting forEach option. Unfortunately, projected fields for any multi select column as primary won’t come back as an array. Instead, the values come back as a single string with a separator (;). While you can still apply formatting, you can’t deal with each value individually with the forEach as before.

I’ve provided additional details and a sample implementation of how you might solve this on this answer: https://sharepoint.stackexchange.com/a/290961/2881

In summary, we have to get creative with a series of conditional elements that are extracting values using a complex combination of if, substring, and indexOf operators. This approach does work but has some drawbacks:

  • It’s super complex to read/write
  • It can only handle a fixed set of values with each value having increasingly complex formulas to extract those values

javascript – webp picture format and fallback techniques

I want to build a community website where people can upload pictures and give comments and such things.
I have heard about webp picture format: it can help to load pictures faster because mostly the pictures’ file size will be smaller.

I am using node.js and Javascript and I want to search now for a script for picture upload, I think it will not be so complicate to find something for picture upload and also transfer picture to webp format.

But I ask myself what to do if a browser does not support that format, i have hear that you need to code a fallback in that case and give the browser jpg format, but this would also mean that I need from every picture a webp format and a jpg format, or how is this usually done?

Photo noise level in RAW format

Why is the noise level of raw photos higher than jpeg photos?
I have encountered this issue several times.

java – Architectural problem for class combination (cartesian product) for save format strategy

Hello to everyone and thank you for any suggestion.

I have a family of subclasses of Track (Track is abstract).
Every concrete Track has a different number and types of fields (attributes) that extend the basic abstract track-fields.

Then I have a family of file-types that implement some methods (saveRow() etc..).
Every file is presumed to have different type of row-formatting (imagine csv tabs, headers etc..)

ex:

  • SimpleTrack: double lat, double lon, Calendar dateTime.
  • DetectionTrack: (as SimpleTrack) + boolean detection.
  • ..
  • CsvFile
  • TxtFile

When I create a new (X)Track and a (Y) file, they are independent by nature, but.. the row is a cartesian product of track & row types.

EDIT
(to be more clear): How can I have many concrete-tracks in one hand and many FileTypes in the other hand, and create well-formatted-rows (differents for every file) by tracks which have different data (columns, headers..)?
es:

  • XtrackRow(double a, double b, Calendar date) -> to -> CVSfile (tab delimited with headers)
  • XtrackRow(double a, double b, Calendar date) -> to -> TXTfile (formatted columns and title)
  • YtrackRow(double a, string, b, int c, double e) -> to CSV ..
  • YtrackRow …. -> to -> docx file (with another kind of table or tabulation)
    ..

I see two kinds of solutions:

  1. Tracks send (right)-formatted row to file: every track has to know which kind of format apply (to rows) to give them to save to any specific type of file.
  2. Tracks send raw-data to any kind of file which is responsible to format them: in this case, the file-class must know wich kind of data has to format (every track has diffrent contents, columns, headers..). Moreover, every track-class has to send different number and types of parameter..

The second solution seems to be more fitted to the Single-Responsibility principle.. but I have no Idea how to implement it.

I tried to use Bridge Pattern to solve this problem (using first solution):

abstract class Track{
  ...
  FileInterface file;

  Track(FileInterface fileType){
    this.file = fileType;
  }

  abstract String formatConcreteTrackRow();
  
  void sendRow(){
    String rowToSave = formatConcreteTrackRow();
    file.saveRow(rowToSave);
  }
}

By this way the problem is not already solved, because every concrete-track has to implement a set of methods which returs right formatted rowString: one for every file-type.
If I use a Strategy Pattern:

class SimpleTrack extends Track{
  ...
  RowFormatStrategy rowStrategy;
  
  @override
  String formatConcreteTrackRow(){
    return this.rowStrategy.getRowString("args")
}

but in this case.. every concrete-track require a different StrategyInterface, because every concrete-track has different number and types of arguments to elaborate..
If I do not use Strategy Pattern and I define a set of methods (formatCsvRow(args),formatTxtRow(args)..) I need to include a switch(fileType) loop to choose which method to use.. breaking SOLID principles.. 🙁

Moreover..
how to impose, for every new concrete-track to have right row-format methods for every existent file-template-row?
and.. How to impose, at the same time, for every new file-class to impose new templates and relative methods in every existent concrete-track?

To be honest, it’s also quite reductive impose formatConcreteTrackRow to be a String, but it’s over and over the main problem.

I’m not interested to maintain this kind of class structure, this is only the best solution I found trying to follow SOLID principles. If you can show me a better solution, my intent is to study and understand SOLID procedures to solve these kind of purposes.

(I looked around for similar questions, but I’m not even able to define the specific problem itself..)
Thank you very much.

validation – Input Data is specific format

I have a column set to text (I could change this to number eventually).

I would like to set a validation message for inputting a set of 12 numbers separated by a dash (Total 13 characters) in the following format 123456-123456.

This information is normally copied from another site as a reference number. So the copied value will have a dash included.

How can I achieve this?

java – Design pattern problem for class combination (cartesian product) for save format strategy

Hello to everyone and thank you for any suggestion.

I have a family of subclasses of Track (Track is abstract).
Every concrete Track has a different number and types of fields (attributes) that extend the basic abstract track-fields.

Then I have a family of file-types that implement some methods (saveRow() etc..).
Every file is presumed to have different type of row-formatting (imagine csv tabs, headers etc..)

ex:

  • SimpleTrack: double lat, double lon, Calendar dateTime.
  • DetectionTrack: (as SimpleTrack) + boolean detection.
  • ..
  • CsvFile
  • TxtFile

When I create a new (X)Track and a (Y) file, they are independent by nature, but.. the row is a cartesian product of track & row types.

I see two kinds of solutions:

  1. Tracks send (right)-formatted row to file: every track has to know which kind of format use to send formatted-row to a specific type of file.
  2. Tracks send raw-data to file which is responsible to format them: in this case, the file class must know wich kind of data has to format (headers, type of data..). Moreover, every track-class has to send different number and types of parameter..

The second solution seems to be more fitted to the Single-Responsibility principle.. but I have no Idea how to implement it.

I tried to use Bridge Pattern to solve this problem (using first solution):

abstract class Track{
  ...
  FileInterface file;

  Track(FileInterface fileType){
    this.file = fileType;
  }

  abstract String formatConcreteTrackRow();
  
  void sendRow(){
    String rowToSave = formatConcreteTrackRow();
    file.saveRow(rowToSave);
  }
}

By this way the problem is not already solved, because every concrete-track has to implement a set of methods which returs right formatted rowString: one for every file-type.
If I use a Strategy Pattern:

class SimpleTrack extends Track{
  ...
  RowFormatStrategy rowStrategy;
  
  @override
  String formatConcreteTrackRow(){
    return this.rowStrategy.getRowString("args")
}

but in this case.. every concrete-track require a different StrategyInterface, because every concrete-track has different number and types of arguments to elaborate..
If I do not use Strategy Pattern and I define a set of methods (formatCsvRow(args),formatTxtRow(args)..) I need to include a switch(fileType) loop to choose which method to use.. breaking SOLID principles.. 🙁

Moreover..
how to impose, for every new concrete-track to have right row-format methods for every existent file-template-row?
and.. How to impose, at the same time, for every new file-class to impose new templates and relative methods in every existent concrete-track?

To be honest, it’s also quite reductive impose formatConcreteTrackRow to be a String, but it’s over and over the main problem.

I’m not interested to maintain this kind of class structure, this is only the best solution I found trying to follow SOLID principles. If you can show me a better solution, my intent is to study and understand SOLID procedures to solve these kind of purposes.

(I looked around for similar questions, but I’m not even able to define the specific problem itself..)
Thank you very much.

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', '')))"
  }
}

How do I download a form table in CSV or Excel format?

I have a form whose class extends FormBase. The form has a table that gets populated with information.

Basically I’m trying to download the table into a CSV or Excel file. I’ve seen some old posts for Drupal 6 but I haven’t found anything for Drupal 8.

How can I achieve this?

8 – Trying to get a node over REST says ‘Not acceptable format: json’

(Yes there are other questions the same as this, but they’re older versions and the solutions there don’t work.)

I have this REST resource config rest.resource.entity.node.yml:

uuid: 248f9825-289c-4201-9f5b-a8d63cf2e5ca
langcode: en
status: true
dependencies:
  module:
    - basic_auth
    - hal
    - node
    - serialization
_core:
  default_config_hash: t_jfECmZhJqBOJuSOFn87EOi_TWi-_fRYTuJgd19vgg
id: entity.node
plugin_id: 'entity:node'
granularity: resource
configuration:
  methods:
    - GET
    - POST
    - DELETE
    - PATCH
  formats:
    - hal_json
    - json
  authentication:
    - basic_auth

When I go to /node/123?_format=json, I get:

 {"message":"Not acceptable format: json"}

I don’t understand what’s going wrong.

I can see the rest.entity.node.GET route in the {router} DB table. The _format property for that says ‘webapp_json’ rather than ‘json’. Is that normal?

The full route definition from the DB is:

C:31:"SymfonyComponentRoutingRoute":1467:{a:9:{s:4:"path";s:12:"/node/{node}";s:4:"host";s:0:"";s:8:"defaults";a:2:{s:11:"_controller";s:34:"DrupalrestRequestHandler::handle";s:21:"_rest_resource_config";s:6:"webapp";}s:12:"requirements";a:4:{s:7:"_access";s:4:"TRUE";s:14:"_entity_access";s:9:"node.view";s:26:"_csrf_request_header_token";s:4:"TRUE";s:7:"_format";s:11:"webapp_json";}s:7:"options";a:5:{s:14:"compiler_class";s:33:"DrupalCoreRoutingRouteCompiler";s:10:"parameters";a:2:{s:4:"node";a:2:{s:4:"type";s:11:"entity:node";s:9:"converter";s:30:"paramconverter.latest_revision";}s:21:"_rest_resource_config";a:2:{s:4:"type";s:27:"entity:rest_resource_config";s:9:"converter";s:30:"paramconverter.latest_revision";}}s:5:"_auth";a:2:{i:0;s:10:"basic_auth";i:1;s:6:"cookie";}s:14:"_access_checks";a:3:{i:0;s:20:"access_check.default";i:1;s:19:"access_check.entity";i:2;s:24:"access_check.header.csrf";}s:4:"utf8";b:1;}s:7:"schemes";a:0:{}s:7:"methods";a:1:{i:0;s:3:"GET";}s:9:"condition";s:0:"";s:8:"compiled";C:33:"DrupalCoreRoutingCompiledRoute":440:{a:11:{s:4:"vars";a:1:{i:0;s:4:"node";}s:11:"path_prefix";s:0:"";s:10:"path_regex";s:29:"#^/node/(?P<node>(^/)++)$#sDu";s:11:"path_tokens";a:2:{i:0;a:5:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:6:"(^/)++";i:3;s:4:"node";i:4;b:1;}i:1;a:2:{i:0;s:4:"text";i:1;s:5:"/node";}}s:9:"path_vars";a:1:{i:0;s:4:"node";}s:10:"host_regex";N;s:11:"host_tokens";a:0:{}s:9:"host_vars";a:0:{}s:3:"fit";i:2;s:14:"patternOutline";s:7:"/node/%";s:8:"numParts";i:2;}}}}