javascript – SPFx – Update a calculated column formula

I am trying to use to update a calculated column formula in my SPFx WebPart.

I get a status code of 400 with the error message: “The parameter __metadata does not exist in method GetByTitle.”

I have created the following function to perform this operation:

private _setCalculatedColumn(ListURL: string, ListTitle: string): void{
    const body: ISPHttpClientOptions = {
        body: `{'__metadata':{'type':'SP.FieldCalculated'},'Formula':'(my new formula)'}`
        ListURL + `/_api/web/Lists/GetByTitle('`+ ListTitle +`')/Fields/GetByTitle('AutoTaskDueDate')`, 
        .then((response: SPHttpClientResponse) => {
            console.log(`Status code: ${response.status}`);
            console.log(`Status text: ${response.statusText}`);

            //response.json() returns a promise so you get access to the json in the resolve callback.
            response.json().then((responseJSON: JSON) => {

I have found an example using Microsoft Flow but that is the closest I can find to updating a formula via a POST request.

I have changed around the body string and get a similar error message.


json – postgresql error while using column values in jsonb_set function

I am trying to update a field value in jsonb column with text value present in another column but getting some syntax errors; not getting any solution.

i am trying to swap values of OutgoingVertexid & IncomingVertexId in below JSONB


so used below code by putting all values OutgoingVertexid & IncomingVertexid value in temp table.

UPDATE temp_table 
        owner_property = CASE 
                            WHEN owner_outgoing_edge IS NOT NULL 
                                THEN jsonb_set(owner_property, '{OutgoingVertexid}', '""')
                                jsonb_set(owner_property, '{OutgoingVertexid}', ''||owner_incoming_edge::jsonb||'') 

but getting below error:

ERROR: invalid input syntax for type json LINE 7: … jsonb_set(owner_property, ‘{OutgoingVertexid}’, ”””||ow… ^ DETAIL: Token “‘” is invalid.


Thanks in Advance

javascript – Is there better way to add column to two dimensional array

I have an two dimensional array as

var textarray = (({ text: 'Content 1' }, { text: 'Content 2' }), 
                 ({ text: 'Content 3' }, { text: 'Content 4' }));

I have a method to add column to matrix in the right as

insertColumnAtRight() {
    for (var i = 0; i < this.textarray.length; i++) {
      this.textarray(i).push({ text: "" });

Is there any better way or shorter way to add column to 2 dimension array?

sharepoint server – jQuery hiding column based on another column’s value

Try adding below code on your EditForm.aspx page:

$(document).ready(function() {
    if ($("select(title='Check SharePoint?')").val() != "Yes") {
        $('nobr:contains("Date SharePoint Checked")').closest('tr').hide();
    else {
        $('nobr:contains("Date SharePoint Checked")').closest('tr').show();


function runAfterPageLoads(){
    if ($("select(title='Check SharePoint?')").val() != "Yes") {
        $('nobr:contains("Date SharePoint Checked")').closest('tr').hide();
    else {
        $('nobr:contains("Date SharePoint Checked")').closest('tr').show();

If this doesn’t work then try one of the solutions given in my answer in below link:

Run Javascript after page loads

Correct column order of comparison data table

I need to design a table where the user will need to approve new values. The table will show him two old values and the gap between the old ones and the new one (The percentage represent the gap from the old value to the new value), if he’ll see a suspicious percentage gap he will check the amounts.

Do you have an idea of how to sort the columns for efficient scanning and so it will be clear what the percentage represents?

Table design example

sharepoint online – Calculated Column – Days Difference – Syntax Error

I have a SharePoint List and I’d like to have a column to calculate the days it take to solve a ticket (Solution date – Submission Date).

I tried to create a calculated column, by using a formula = DATEDIF((Submission Date),(Solution Date),"D"), and return data with “Number”. It didn’t allow me to create this as it says Syntax error.

I researched and tried to replaced “,” with “;” = DATEDIF((Submission Date);(Solution Date);"D") , still didn’t work.

Both Solution date & Submission Date columns are formatted as “Date and Time” Type.

python – How to update a column in sql based on another table’s last row, column value

I’m currently on the process of making a CRUD Database program. I’m having some trouble with the database. I would like to link 2 columns with each other. It’s quite different from usual though, it’s a little more complicated.

So, I have a table named items_list which have a column called ‘Item Name’ where each item has its own ‘Stock Count'(another column).

Each of these items then have their own table (item_name) which have columns of Date, Description, and Stock Count. I would like to know how I could connect these tables together so that when I add the latest stock count (with the latest date) into the (item_name) table, it would automatically update the ‘Stock Count’ in the items_list table.

Additionally, I would like to know how to automatically create a new table when a new item is added into the items_list.

I know it might be very confusing but if you have further questions, feel free to email me at Thank you so much in advance.

Below is the program code I have:

from tkinter import *
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import sqlite3

def update(rows):
    for i in rows:
        tree.insert('', 'end', value=i)

def search():
    q2 = q.get()
    query = "SELECT TipeBarang, NoKartu, JumlahStok FROM items_list WHERE TipeBarang LIKE '%"+q2+"%'"
    rows = cursor.fetchall()

def clear():
    query = "SELECT TipeBarang, NoKartu, JumlahStok FROM items_list"
    rows = cursor.fetchall()

def getrow(event):
    rowid = tree.identify_row(event.y)
    item = tree.item(tree.focus())

def update_item():
    new = t1.get()
    new_card = t2.get()
    new_count = t3.get()
    if messagebox.askyesno('Confimation', 'Yakin ubah?'):
        query = "UPDATE items_list SET JumlahStok = ? WHERE TipeBarang = ? AND NoKartu = ?"
        parameters = (new_count, new, new_card)
        cursor.execute(query, parameters)
        return True

def add_item():
    new = t1.get()
    new_card = t2.get()
    new_count = t3.get()
    if messagebox.askyesno('Confirmation', 'Tambah Barang Baru?'):
        query = "INSERT INTO items_list(TipeBarang, NoKartu, JumlahStok) VALUES(?, ?, ?)"
        parameters = (new, new_card, new_count)
        cursor.execute(query, parameters)
        return True

def delete_item():
    item_id = ent1.get()
    if messagebox.askyesno('Confirmation', 'Yakin Hapus?'):
        query = "DELETE FROM items_list WHERE TipeBarang = "+"'"+item_id+"'"
        return True

def open_card_window():

    def update_small(rows):
        for i in rows:
            smalltree.insert('', 'end', value=i)

    def getrow_small(event):
        rowid = smalltree.identify_row(event.y)
        item = smalltree.item(smalltree.focus())

    def update_card():
        return True

    def add_card():
        return True

    def delete_card():
        return True

    card_content = Toplevel(root)
    card_content.title('Kartu Stok')

    text1 = StringVar()
    text2 = StringVar()
    text3 = StringVar()
    text4 = StringVar()
    text5 = StringVar()

    subframe1 = LabelFrame(card_content)
    subframe2 = LabelFrame(card_content, text='Ubah Konten')
    subframe1.pack(fill='both', expand='True', padx=20, pady=10)
    subframe1.config(bg='light grey')
    subframe2.pack(fill='both', expand='True', padx=20, pady=10)
    subframe2.config(bg='light grey')

    smalltree = ttk.Treeview(subframe1, height=20, columns=(1,2,3,4,5), show='headings')
    smalltree.pack(expand=True, fill='x')
    smalltree.heading(1, text='Tanggal')
    smalltree.heading(2, text='Keterangan')
    smalltree.heading(3, text='Masuk')
    smalltree.heading(4, text='Keluar')
    smalltree.heading(5, text='Total Stok')

    smalltree.bind('<Double 1>', getrow_small)

    #User Data Section
    label1 = Label(subframe2, text='Tanggal:')
    label1.grid(row=0, column=0, padx=5, pady=3)
    label1.config(bg='light grey')
    entry1 = Entry(subframe2, textvariable=text1)
    entry1.grid(row=0, column=1, padx=5, pady=3)

    label2 = Label(subframe2, text='Keterangan:')
    label2.grid(row=1, column=0, padx=5, pady=3)
    label2.config(bg='light grey')
    entry2 = Entry(subframe2, textvariable=text2)
    entry2.grid(row=1, column=1, padx=5, pady=3)

    label3 = Label(subframe2, text='Masuk:')
    label3.grid(row=2, column=0, padx=5, pady=3)
    label3.config(bg='light grey')
    entry3 = Entry(subframe2, textvariable=text3)
    entry3.grid(row=2, column=1, padx=5, pady=3)

    label4 = Label(subframe2, text='Keluar:')
    label4.grid(row=3, column=0, padx=5, pady=3)
    label4.config(bg='light grey')
    entry4 = Entry(subframe2, textvariable=text4)
    entry4.grid(row=3, column=1, padx=5, pady=3)

    label5 = Label(subframe2, text='Total:')
    label5.grid(row=4, column=0, padx=5, pady=3)
    label5.config(bg='light grey')
    entry5 = Entry(subframe2, textvariable=text4)
    entry5.grid(row=4, column=1, padx=5, pady=3)

    upd_crd = Button(subframe2, text='Update', command=update_card)
    add_crd = Button(subframe2, text='Add New', command=add_card)
    del_crd = Button(subframe2, text='Delete', command=delete_card)

    add_crd.grid(row=5, column=0, padx=5, pady=3)
    upd_crd.grid(row=5, column=1, padx=5, pady=3)
    del_crd.grid(row=5, column=2, padx=5, pady=3)

    item_id = ent1.get()
    query = "SELECT * FROM "+"'"+item_id+"'"
    rows = cursor.fetchall()

#Connecting to Database
db = sqlite3.connect('stok.db')
cursor = db.cursor()

root = Tk()
q = StringVar()
t1 = StringVar()
t2 = StringVar()
t3 = StringVar()

wrapper1 = LabelFrame(root, text='List Stok')
wrapper2 = LabelFrame(root, text='Search')
wrapper3 = LabelFrame(root, text='Update Data')
wrapper1.pack(fill='both', expand='True', padx=20, pady=10)
wrapper1.config(bg='light grey')
wrapper2.pack(fill='both', expand='True', padx=20, pady=10)
wrapper2.config(bg='light grey')
wrapper3.pack(fill='both', expand='True', padx=20, pady=10)
wrapper3.config(bg='light grey')

tree = ttk.Treeview(wrapper1, height=17, columns=(1,2,3), show='headings')
tree.pack(expand=True, fill='x')
tree.heading(1, text='Tipe Barang')
tree.heading(2, text='Nomor Kartu')
tree.heading(3, text='Jumlah Stok') = ttk.Style()'Treeview', font=('helvetica',16))'Treeview.Heading', font=('helvetica', 18, 'bold'))

tree.bind('<Double 1>', getrow)

query = 'SELECT TipeBarang, NoKartu, JumlahStok FROM items_list'
rows = cursor.fetchall()

#Search Section
searchfield = Entry(wrapper2, textvariable=q)
searchfield.pack(side=tk.LEFT, padx=25)
btn= Button(wrapper2, text='Search', command=search)
btn.pack(side=tk.LEFT, padx=6)
clr = Button(wrapper2, text='Clear', command=clear)
clr.pack(side=tk.LEFT, padx=6)

#User Data Section
lbl1 = Label(wrapper3, text='Tipe Barang:')
lbl1.grid(row=0, column=0, padx=5, pady=3)
lbl1.config(bg='light grey')
ent1 = Entry(wrapper3, textvariable=t1)
ent1.grid(row=0, column=1, padx=5, pady=3)

lbl2 = Label(wrapper3, text='Nomor Kartu:')
lbl2.grid(row=1, column=0, padx=5, pady=3)
lbl2.config(bg='light grey')
ent2 = Entry(wrapper3, textvariable=t2)
ent2.grid(row=1, column=1, padx=5, pady=3)

lbl3 = Label(wrapper3, text='Jumlah Stok:')
lbl3.grid(row=2, column=0, padx=5, pady=3)
lbl3.config(bg='light grey')
ent3 = Entry(wrapper3, textvariable=t3)
ent3.grid(row=2, column=1, padx=5, pady=3)

upd_btn = Button(wrapper3, text='Update', command=update_item)
add_btn = Button(wrapper3, text='Add New', command=add_item)
del_btn = Button(wrapper3, text='Delete', command=delete_item)

open_card = Button(wrapper3, text='Open Card', command=open_card_window)

add_btn.grid(row=5, column=0, padx=5, pady=3)
upd_btn.grid(row=5, column=1, padx=5, pady=3)
del_btn.grid(row=5, column=2, padx=5, pady=3)
open_card.grid(row=1, column=3, padx=10)

root.title('Stok Barang Sumber Makmur')
root.configure(background='light grey')

Note: the column names are in Bahasa Indonesia. Where TipeBarang basically means Item Name and JumlahStok is Stock Count

query – MySQL Dynamic Result view with column when values are on same column

I want to create a dynamic value based on election result. I’ve three table.

  1. vote table
  2. Candidate table
  3. Candidate position table.

Here the candidate table and position table is dynamic. its means I haven’t any control on it.

I want to make a view like this:
enter image description here

Here Ballton num come from vote table, president, general secretary and treasurer is come from candidate position table and against each ballot no all column will be populate.

Here are the rest of the table structure:

enter image description here

enter image description here

Candidate position:
enter image description here