I have two lists A and B. I've created a lookup column on B to get data from A (item # and item address). I want to customize the view when opening an item on list B. But I can't find a way to make the fields from A visible on B. I get
Failure: TEST_x0020_SHIPPING_x0020_ADDRES1 was not found on the data object.
I checked the name of the field and it's correct and contains data. Please check the attached image. Is there a way to get that information on that view?
Note: if I disable debug it shows nothing.
Thanks in advance!
JSONERROR
Update: The code I'm using on the Header comes from the MS official site https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-configuration
{
"debugMode": false,
"elmType": "div",
"attributes": {
"class": "ms-borderColor-neutralTertiary"
},
"style": {
"width": "99%",
"border-top-width": "0px",
"border-bottom-width": "1px",
"border-left-width": "0px",
"border-right-width": "0px",
"border-style": "solid",
"margin-bottom": "16px"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"box-sizing": "border-box",
"align-items": "center"
},
"children": [
{
"elmType": "div",
"attributes": {
"iconName": "Devices3",
"class": "ms-fontSize-42 ms-fontWeight-regular ms-fontColor-themePrimary",
"title": "Details"
},
"style": {
"flex": "none",
"padding": "0px",
"padding-left": "0px",
"height": "36px"
}
}
]
},
{
"elmType": "div",
"attributes": {
"class": "ms-fontColor-neutralSecondary ms-fontWeight-bold ms-fontSize-24"
},
"style": {
"box-sizing": "border-box",
"width": "100%",
"text-align": "left",
"padding": "21px 12px",
"overflow": "hidden"
},
"children": [
{
"elmType": "div",
"txtContent": "='Store ' + [$TEST_x0020_SHIPPING_x0020_ADDRES1]"
}
]
}
]
}
Related
First time poster, long-time reader!
I am writing the JSON for an Apple News story. I have three consecutive full-screen fill images. They are all set to "attachment":"fixed". The transition from one image to another, when scrolling, is to reveal the next image continuously. I would like the "incoming" image to replace the prior image wholesale -- it just appears after someone scrolls to the bottom of the prior image. Hoping that makes sense, since I can't show the actual Apple News preview. I don't want to use an animation, since that only appears once; I want the same behavior when people scroll backwards.
Here's what I have now ... and the scrolling reveal IS what I expected. I want the very different behavior detailed above!
"components": [
{
"role": "header",
"style": "leadVideoStyle",
"layout": {
"ignoreDocumentMargin": true,
"minimumHeight": "125vh"
},
"components": [
{
"role": "container",
"anchor": {
"targetAnchorPosition": "top"
},
"style": "scrimBackgroundStyle",
"layout": {
"ignoreDocumentMargin": true
},
"components": [
{
"role": "title",
"layout": "titleLayout",
"text": "some text",
"textStyle": "titleStyle",
"format": "html"
},
{
"role": "intro",
"layout": "introLayout",
"text": "some text,
"textStyle": "introStyle"
}
]
}
]
},
{
"role": "section",
"layout": {
"ignoreDocumentMargin": true,
"minimumHeight": "200vh"
},
"style": "leadPhotoStyle1"
},
{
"role": "section",
"layout": {
"ignoreDocumentMargin": true,
"minimumHeight": "200vh"
},
"style": "leadPhotoStyle2"
}
],
"leadVideoStyle": {
"fill": {
"type": "video",
"URL": "URL here",
"stillURL": "bundle URL",
"fillMode": "cover",
"verticalAlignment": "top",
"attachment": "fixed"
}
},
"leadPhotoStyle1": {
"fill": {
"type": "image",
"URL": "URL here",
"fillMode": "cover",
"verticalAlignment": "top",
"attachment": "fixed"
}
},
"leadPhotoStyle2": {
"fill": {
"type": "image",
"URL": "URL here",
"fillMode": "cover",
"verticalAlignment": "top",
"attachment": "fixed"
}
is it possible to change view from list to thumbnail on document library sharepoint 2016?
I've searched for documentation on google, youtube, microsoft still can't find the answer, please help. Currently the display of the user is still a list
You could achieve this by using view formatting.
Make sure your library contains 'Type', 'Create by' and 'Type' column.
1.View -> formatting current view -> Prase following code.
enter image description here
2.Choose layout to 'Gallery'-> save.
code template:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json Jump ",
"tileProps": {
"hideSelection": true,
"height": "280",
"width": "300",
"formatter": {
"elmType": "div",
"style": {
"align-items": "stretch",
"margin": "3px 2px",
"background-color": "#fbfbfb",
"height": "380px",
"overflow": "inherit",
"border-radius": "2px",
"box-shadow": "0px 1.6px 3.6px 0 #00000024, 0px 0.3px 0.9px 0 #00000024"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-wrap": "wrap",
"position": "relative",
"padding-bottom": "10px",
"width": "100%"
},
"children": [
{
"elmType": "div",
"style": {
"margin-top": "0px",
"height": "200px",
"display": "block",
"align-items": "center",
"justify-content": "center",
"position": "relative",
"border-bottom": "1px solid #EEE",
"overflow": "hidden",
"border-radius": "2px 2px 0 0"
},
"children": [
{
"elmType": "button",
"style": {
"position": "absolute",
"height": "100%",
"width": "100%",
"opacity": "0",
"cursor": "pointer"
},
"customRowAction": {
"action": "defaultClick"
}
},
{
"elmType": "div",
"style": {
"width": "=if([$File_x0020_Type] == '', '100px', '100%')",
"height": "=if([$File_x0020_Type] == '', '100px', '100%')",
"oveflow": "=if([$File_x0020_Type] == '', 'auto', 'hidden')",
"text-align": "center",
"overflow": "hidden"
},
"children": [
{
"elmType": "img",
"style": {
"height": "=if([$File_x0020_Type] == '', '100%', '0'"
},
"attributes": {
"src": "=if([$File_x0020_Type] == '', 'https://spoprod-a.akamaihd.net/files/fabric/office-ui-fabric-react-assets/foldericons-fluent/folder-large_frontplate_nopreview.svg Jump ', '')"
}
},
{
"elmType": "img",
"style": {
"display": "=if([$File_x0020_Type] == '', 'none', '')"
},
"attributes": {
"src": "#thumbnail.383x383"
}
}
]
}
]
},
{
"elmType": "div",
"style": {
"margin": "25px 0 0 0",
"position": "absolute",
"top": "153px",
"width": "100%",
"color": "#333333"
},
"attributes": {
"class": "ms-fontSize-14 ms-fontWeight-semibold"
},
"children": [
{
"elmType": "img",
"attributes": {
"src": "=if([$File_x0020_Type] == 'docx', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/docx.svg?v6 Jump ', if([$File_x0020_Type] == 'xlsx', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/xlsx.svg?v6 Jump ', if([$File_x0020_Type] == 'pptx', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/pptx.svg?v6 Jump ', if([$File_x0020_Type] == 'pdf', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/pdf.svg?v6 Jump ', if([$File_x0020_Type] == 'jpg' || [$File_x0020_Type] == 'png' || [$File_x0020_Type] == 'gif','https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/photo.svg?v6 Jump ', if([$File_x0020_Type] == 'mp4' || [$File_x0020_Type] == 'avi' || [$File_x0020_Type] == 'mov', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/video.svg?v6 Jump ', if([$File_x0020_Type] == 'zip', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/zip.svg?v6 Jump ','Unknown')))))))"
},
"style": {
"flex": "none",
"line-height": "100%",
"font-weight": "normal",
"font-size": "2rem",
"margin": "5px 5px 5px 10px",
"height": "25px"
}
},
{
"elmType": "div",
"txtContent": "[$FileLeafRef]",
"style": {
"padding": "0 0 0 16px"
}
},
{
"elmType": "div",
"txtContent": "='edited by ' + [$Editor.title]",
"style": {
"padding": "0 0 0 16px"
}
}
]
}
]
}
]
}
}
}
I'm trying to create a button that only appears if the "Zapůjčeno" column is empty.
{
"elmType": "button",
"txtContent": "Odeslat Žádost",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"7347b7be-696f-46c8-bae8-78c230a354b3\"}"
},
"style": {
"background-color": "#03A9F4",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "!=",
"operands": [
"[$ID]",
"1"
]
},
"hidden",
"visible"
]
}
}
}
Example with "ID" column
If I try it with the default column "ID" it works, but if I want to use my column "Zapůjčeno" it doesn't work.
Thank you for your advice, I am a novice in SharePoint.
Is the column Zapůjčeno internal name the same as the display name? You can see the internal name of that column in list/library settings an then click on the column name. The internal name of this column will in the URL.
I think you can then use something like this:
{
"elmType": "button",
"txtContent": "= if([$Zapůjčeno_Internal_Name]=='','Odeslat Žádost', '')",
"customRowAction": {
"action": "executeFlow",
"actionParams": "='{\"id\": \"' + if([$Zapůjčeno_Internal_Name]=='','7347b7be-696f-46c8-bae8-78c230a354b3','') + '\"}'"
},
"style": {
"background-color": "#03A9F4",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "!=",
"operands": [
"[$ID]",
"1"
]
},
"hidden",
"visible"
]
}
}
}
As #Rikking said, you need ro use the internal name in json.
My test column formating json for your reference:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children":[
{
"elmType":"button",
"style":{
"background-color":"=if([$Zap_x016f_j_x010d_eno]=='','lightblue','')",
"width":"80px",
"height":"50px",
"display":"=if([$Zap_x016f_j_x010d_eno]=='','','none')"
},
"txtContent":"=if([$Zap_x016f_j_x010d_eno]=='','Odeslat Žádost','')"
}
]
}
Test result:
Zap_x016f_j_x010d_eno is the internal name of Zapůjčeno,the default language of my SharePoint Online is English.
I'm following this article:
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#formatting-items-based-on-arbitrary-dates-advanced
I have an SP List with Renewal Date and would like to be it marked if the date is smaller than today-31 days so I modified the example from the article to:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "#currentField",
"style": {
"color": "=if([$Renewal_x0020_Date] <= #now - 2678400000, '#ff0000', '')"
}
}
So, according to "to add a day to a date, you'd add (24*60*60*1000 = 86,400,000)" I multiply this by 31.
Unfortunately, the JSON doesn't format my view.
Could someone direct me, please?
Thanks
Slawek
Column formatting seems to be working for modern experience only. Here are the results.
New/Modern Experience
Classic Experience:
So Try switching the experience if your list is currently set to open in classic view.
First example with $RenewalDate
Try with this ternary (?) operator code
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "#currentField",
"style": {
"color": {
"operator": "?",
"operands": [
{
"operator": "<=",
"operands": [
"[$RenewalDate]",
{
"operator": "+",
"operands": [
"#now",
-2678400000
]
}
]
},
"#ff0000",
""
]
}
}
}
Second example is column with space in name $Renewal_x0020_Date
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "#currentField",
"style": {
"color": {
"operator": "?",
"operands": [
{
"operator": "<=",
"operands": [
"[$Renewal_x0020_Date]",
{
"operator": "+",
"operands": [
"#now",
-2678400000
]
}
]
},
"#ff0000",
""
]
}
}
}
EDIT:
using the Excel-style expression syntax
Column without space $RenewalDate
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "#currentField",
"style": {
"color": "=if([$RenewalDate] <= #now - 2678400000, '#ff0000', '')"
}
}
Column with space $Renewal_x0020_Date
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "#currentField",
"style": {
"color": "=if([$Renewal_x0020_Date] <= #now - 2678400000, '#ff0000', '')"
}
}
Say I have a product collection like this:
{
"_id": "5a74784a8145fa1368905373",
"name": "This is my first product",
"description": "This is the description of my first product",
"category": "34/73/80",
"condition": "New",
"images": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstproduct_image1.jpg"
},
...
],
"attributes": [
{
"name": "Material",
"value": "Synthetic"
},
...
],
"variation": {
"attributes": [
{
"name": "Color",
"values": ["Black", "White"]
},
{
"name": "Size",
"values": ["S", "M", "L"]
}
]
}
}
and a variation collection like this:
{
"_id": "5a748766f5eef50e10bc98a8",
"name": "color:black,size:s",
"productID": "5a74784a8145fa1368905373",
"condition": "New",
"price": 1000,
"sale": null,
"image": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstvariation_image1.jpg"
}
],
"attributes": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
]
}
I want to keep the documents separate and for the purpose of easy browsing, searching and faceted search implementation, I want to fetch all the data in a single query but I don't want to do join in my application code.
I know it's achievable using a third collection called summary that might look like this:
{
"_id": "5a74875fa1368905373",
"name": "This is my first product",
"category": "34/73/80",
"condition": "New",
"price": 1000,
"sale": null,
"description": "This is the description of my first product",
"images": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstproduct_image1.jpg"
},
...
],
"attributes": [
{
"name": "Material",
"value": "Synthetic"
},
...
],
"variations": [
{
"condition": "New",
"price": 1000,
"sale": null,
"image": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstvariation_image.jpg"
}
],
"attributes": [
"color=black",
"size=s"
]
},
...
]
}
problem is, I don't know how to keep the summary collection in sync with the product and variation collection. I know it can be done using mongo-connector but i'm not sure how to implement it.
please help me, I'm still a beginner programmer.
you don't actually need to maintain a summary collection, its redundant to store product and variation summary in another collection
instead of you can use an aggregate pipeline $lookup to outer join product and variation using productID
aggregate pipeline
db.products.aggregate(
[
{
$lookup : {
from : "variation",
localField : "_id",
foreignField : "productID",
as : "variations"
}
}
]
).pretty()