php – Pasar fecha de un datapicker a una ruta json

Amigos, tengo el siguiente problema, tengo un datepicker donde selecciono una fecha, y esa fecha la paso a través de una url json, pero mi problema se genera que la ruta me lee cualquier cosa del campo fecha y no se como traspasarla para recibirla en mi controlador

<div class="col-sm-12">
    <div class="form-group">
    <label> Fecha</label>
    <div class="input-group">
       <span class="input-group-prepend"><span class="input-group-text"><i class="icon-calendar22"></i></span></span>
      <input type="text" class="form-control daterange-single Fecha" value="{{old('fecha')}}" maxlength="10" name="fecha" id="fecha" required>
   </div>
   </div>
</div>

<script>
   $(document).ready(function () {
      function getRespuesta(fecha){
         var fecha1 = $("#fecha").val();
         console.log(fecha1);  //lo que me trae 20/04/2021

         url="{{route('fechas.getRespuesta', ("fecha"=>"#REF#"))}}";
         url=url.replace("#REF#", $("#fecha_ini").val());
         console.log(url);
         $.getJSON(url, {}, function (data) {
           console.log(data);
              swal.close();
              $("#bloques option").remove();
              //console.log(data);
               $.each(JSON.parse(data), function (i, item) {
                   //aca debo mostrar unas opciones con checkbox, que tampoco se como obtener
               });
            })
      }
   });
</script>

Si imprimo console.log(url);, esto me trae de respuesta el siguiente link http://127.0.0.1:8000/respuestas/getRespuestas?fecha=%23REF%23 y obviamente necesito pasar mi fecha ?fecha=24-04-2021 y no se como hacerlo, y tampoco se como armar unos checkbox que traigo de respuesta al seleccionar la fecha.

Ayuda por favor

python – Loop to create Multiple JSON files from the CSVs saved in multiple folder

Hi all can help to enhanced my python code for creating JSON files. I want to create loop that creates json (different json foe each of the folder) from the csv files save in different folder and and then save all the jason in the one common folder. Right now I am using below code and changing the path last two digits manually to create Jason one by one that is very tidious task.

Or is possible to create same task in R?

import csv
import json
import glob
import os

class csv2jsonindirectory():
def Python_trial(self):
# Update the following variable with the path in windows and replace
# every “” with “/”.
path_to_folder = “C:UsersCSVsAO”
csv_files_in_folder = path_to_folder + ‘/*.csv’
csvfilenames = ()
i = 1
mydict = {}
for filename in glob.glob(csv_files_in_folder):
csvfilenames.append(os.path.splitext(filename)(0))
rows = ()
for i in range(len(csvfilenames)):
with open(csvfilenames(i) + “.csv”, “r”) as f:
csvreader = csv.DictReader(f)
rows = list(csvreader)
mydict(“chartdiv” + str(i + 1)) = rows

    print(mydict)

    with open(csvfilenames(0) + ".json", 'w') as f:
        json.dump(mydict, f, indent= 4)

dd = csv2jsonindirectory()
dd.Python_trial()

Leer fichero JSON donde los nombres de los campos están en un array y los datos en otro, en Java

Quisiera saber cómo puedo analizar este fichero JSON, donde los nombres de los campos están en un array y los datos en otro. Este esl el fichero JSON:


    {
      "fields": [{"type":"int","id":"_id"},{"info":{"notes":"aa"},"type":"numeric","id":"CodMunicipio"},{"info":{"notes":"bb"},"type":"text","id":"Municipi"},{"info":{"notes":"cc"},"type":"numeric","id":"Casos PCR+"},{"info":{"notes":"dd"},"type":"text","id":"Incidència acumulada PCR+"},{"info":{"notes":"ee"},"type":"numeric","id":"Casos PCR+ 14 dies"},{"info":{"notes":"ff"},"type":"text","id":"Incidència acumulada PCR+14"},{"info":{"notes":"gg"},"type":"numeric","id":"Defuncions"},{"info":{"notes":"hh"},"type":"text","id":"Taxa de defunció"}],
      "records": [
        [1,46001,"Pueblo A",103," 9884,84",0," 0,0",0," 0,0"],
        [2,46002,"Pueblo B",111," 7360,74",3," 198,94",2," 132,63"],
        [3,3001,"Pueblo C",11," 1740,51",0," 0,0",0," 0,0"],
        [4,3002,"Pueblo D",318," 6683,48",4," 84,07",8," 168,14"]
    ]}

He probado de todo, y lo que he visto no se ajusta a lo que busco. Agradezco de antemano vuestra ayuda.

I am extracting data from a Json in SQL and the data comes in lists, how do I get it from there?

thanks for reading it!
I am extracting data from a Json with operators in SQL, this is the code:

'''
select lc.name as company,
lr.name as retailer,
ls.name as tienda,
sm.created_on as date,
sm.task_id as task_id,
ss.submission_data::json-> '¿Qué ''bancos'' se encuentran cerca de la tienda? De ser necesario, pregunta al gerente de tienda' AS banco,
ss.submission_data::json->> 'Indica la distancia aproximada entre la tienda y el ''banco'' más cercano' AS banco_distancia,
ss.submission_data::json->> '¿En la zona hay disponibilidad de ''transporte público''? Indica los tipos de transporte' AS transporte,
ss.submission_data::json->> 'Indica el precio estimado de un viaje en ''transporte público''' AS transporte_precio,
ss.submission_data::json->> '¿En la zona hay servicio de ''aplicaciones de envíos''?' AS app_envio
from submission_submissionmetadata sm
left join submission_submission ss on sm.submission_id = ss.id
left join location_store ls on ls.id = sm.store_id
left join location_retailer lr on lr.id = ls.retailer_id
left join location_company lc on lc.id = lr.company_id
where sm.brand_id = 293 
order by date desc
'''

In The results I get the columns bank, transport and app_ship come as in a list type, I have tried to use functions to flatten this but I have not been successful. Do you know what I can do?

Thanks!!

RESULTS

json formatting – Lists: Show image overlay on mouse over

This might not be exactly what you need, but here is a good start.

In order to display a custom hover card, you need to use customCardProps element. See more details here. It has the following properties:

openOnEvent

  • hover – card appears on mouse hover;
  • click – card appears on click on the field.

directionalHint

  • topCenter bottomCenter leftCenter rightCenter
  • isBeakVisible – boolean. if true the card has a beak.

How to display an image using JSON formatting

{ 
  "elmType": "img",
  "attributes": {
    "src":  "[$Photo]" 
  }
}

And here is a complete script

{
    "elmType": "div",    
    "attributes": {
        "iconName": "Search"
    },
    "customCardProps": {
        "openOnEvent": "hover",
        "directionalHint": "rightCenter",
        "isBeakVisible": true,
        "formatter": {
            "elmType": "div",
            "style":{ "display": "block", "font-size": "15px", "padding": "10px" },
            "children": [
                {
                    "elmType": "div",
                    "style": { "display": "block", "width":"100%", "text-align": "center", "padding": "10px" },
                      "children":[
                      { "elmType": "img",
                            "attributes": {
                                "src":  "[$Photo]" 
                            }
                      }
                      ]
                   
                }
            ]
        }
    }
}

Result

enter image description here

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

search – Exract all node field values to json including reference entities with value

I am writing a module to export drupal’s content to another platform, the module provides a UI to manage content types and their fields to be shared on another platform via API.

So far i have managed to get node field values using this sample code

$nid = 4951;
$node = Drupal::entityTypeManager()->getStorage('node')->load($nid);
$data = ();
foreach ($node->getFields() as $name => $field) {
  $data($name)  = $field->getString();
}

the $field->getString(); however do not provides reference entity values and only provide ids.

The out of the above code is like:

{"nid":"4951","uuid":"0fae7e9b-d860-43f0-9559-a8bd6bab22b7","vid":"1272611","langcode":"en","type":"article","revision_timestamp":"1612303794","revision_uid":"1166","revision_log":"","status":"1","uid":"866","title":"xyz Chapter April Update","created":"1555961981","changed":"1612303794","promote":"0","sticky":"0","default_langcode":"1","revision_default":"1","revision_translation_affected":"1","moderation_state":"published","scheduled_transition_date":"","scheduled_transition_state":"","metatag":"","path":"/wisconsin-chapter-april-update, 17276, en","menu_link":"","body":"some this here, rich_text","field_article_author":"Wisconsin Chapter","field_article_chapter":"541","field_article_endnotes":"","field_article_questions_cta":"1","field_article_recommendation":"","field_article_recommended_link":"","field_article_related":"","field_article_related_link":"","field_article_resource_download":"","field_article_subhead":"Here's the latest news from the abc.","field_article_thumbnail":"","field_article_type":"news","field_blog_section":"","field_meta_tags":"","field_tax_article_type":"24, 28, 45","field_tax_audience":"","field_tax_breadcrumbs":"","field_tax_content_format":"50","field_tax_disease":"55, 56, 57, 58","field_tax_ga_type":"","field_tax_research_type":"","field_tax_topic":"90, 91, 92, 93, 94, 108, 109, 111"}

Scroll last and see for example field_tax_topic

Is there a direct or indirect way of automatically detecting reference entity field and extracting its values, also it should be dynamic solution and that must work with new field types as well.

Any pointer or direction to do it in the right way will help!

elasticsearch – Using Pyspark read data from elastic search and convert into json: error while reading nested objects

I am trying to read data from elastic search using PySpark and convert it into json based on selected columns. If the json has nested objects, I am getting error as “notification.address not found. typically this occurs with arrays which are not mapped as single value”
Below is my ES data

{
 {
  "notification": {
    "Id" : "123",
    "name" : "xyz",
    "address" : {
      "street" : "avenue",
      "zip" : "08812"
    }
  } 
 },
 {
  "notification": {
    "Id" : "897",
    "name" : "abc",
    "address" : {
      "street" : "34-ave",
      "zip" : "02324"
    }
  } 
 },
}

My Elastic search query looks like below

df = spark.read.format(org.elasticsearch.spark.sql")
     .option("es.node","")
     .option("es.port","")
     .option("es.nodes.wan.only", True)
.option("es.read.field.include,"notification.Id,notification.name,notification.address.street,notification.address.zip")
     .option("es.query","")
     .lod("index")

Now my issue is while converting to json, I cannot read nested objects.Below is my code to convert dataframe

df_user = df.withColumn("notification",to_json(struct((df(x) for x in df.columns))))

The above line gives me error
notification.address not found. typically this occurs with arrays which are not mapped as single value

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?