如何在索引包含对象的数组中执行for循环
How to do a for loop in a array with a index that contain object
我正在尝试在这样的数组中执行 for 循环:
a0C7X0000056xmxUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056xmxUAA'
},
Id: 'a0C7X0000056xmxUAA',
Name: 'Lote-6155066',
Guia__c: [ a0Y7X000006RUHxUAO: [Object], a0Y7X000006RUI2UAO: [Object] ]
},
a0C7X0000056x9EUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056x9EUAQ'
},
Id: 'a0C7X0000056x9EUAQ',
Name: 'Lote-6155065',
Guia__c: []
},
a0C7X0000056x99UAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056x99UAA'
},
Id: 'a0C7X0000056x99UAA',
Name: 'Lote-6155064',
Guia__c: [
a0Y7X000006RSSvUAO: [Object],
a0Y7X000006RST0UAO: [Object],
a0Y7X000006RST1UAO: [Object]
]
},
a0C7X0000056x8YUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056x8YUAQ'
},
Id: 'a0C7X0000056x8YUAQ',
Name: 'Lote-6155063',
Guia__c: [ a0Y7X000006RSR9UAO: [Object], a0Y7X000006RSREUA4: [Object] ]
},
a0C7X0000056wmxUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmxUAA'
},
Id: 'a0C7X0000056wmxUAA',
Name: 'Lote-6155062',
Guia__c: [ a0Y7X000006RSR4UAO: [Object] ]
},
a0C7X0000056wmsUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmsUAA'
},
Id: 'a0C7X0000056wmsUAA',
Name: 'Lote-6155061',
Guia__c: [ a0Y7X000006RSQzUAO: [Object] ]
},
a0C7X0000056wmnUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmnUAA'
},
Id: 'a0C7X0000056wmnUAA',
Name: 'Lote-6155060',
Guia__c: [ a0Y7X000006RSQpUAO: [Object], a0Y7X000006RSQuUAO: [Object] ]
},
a0C7X0000056wmYUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmYUAQ'
},
Id: 'a0C7X0000056wmYUAQ',
Name: 'Lote-6155059',
Guia__c: [ a0Y7X000006RSQLUA4: [Object], a0Y7X000006RSQQUA4: [Object] ]
},
a0C7X0000056wmTUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmTUAQ'
},
Id: 'a0C7X0000056wmTUAQ',
Name: 'Lote-6155058',
Guia__c: [
a0Y7X000006RSQGUA4: [Object],
a0Y7X000006RSQVUA4: [Object],
a0Y7X000006RSQaUAO: [Object],
a0Y7X000006RSQfUAO: [Object],
a0Y7X000006RSQkUAO: [Object]
]
},
a0C7X0000056wmOUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmOUAQ'
},
Id: 'a0C7X0000056wmOUAQ',
Name: 'Lote-6155057',
Guia__c: [ a0Y7X000006RSQBUA4: [Object] ]
}
]
但是当我尝试做一个循环时没有任何反应,我这样做是因为在执行过程中我需要添加新的键,比如 Guia__c 并且在 Guia__c 里面我需要放我是新的,这已经发生了,但问题是循环,当我尝试将数组转换为字符串时,什么都没有 returns
Object.values(mapGRD__c)
有必要解决这个问题
像这样:
for(let objectGRD__c of Object.values(mapGRD__c)) {
...Logic
}
我正在尝试在这样的数组中执行 for 循环:
a0C7X0000056xmxUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056xmxUAA'
},
Id: 'a0C7X0000056xmxUAA',
Name: 'Lote-6155066',
Guia__c: [ a0Y7X000006RUHxUAO: [Object], a0Y7X000006RUI2UAO: [Object] ]
},
a0C7X0000056x9EUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056x9EUAQ'
},
Id: 'a0C7X0000056x9EUAQ',
Name: 'Lote-6155065',
Guia__c: []
},
a0C7X0000056x99UAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056x99UAA'
},
Id: 'a0C7X0000056x99UAA',
Name: 'Lote-6155064',
Guia__c: [
a0Y7X000006RSSvUAO: [Object],
a0Y7X000006RST0UAO: [Object],
a0Y7X000006RST1UAO: [Object]
]
},
a0C7X0000056x8YUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056x8YUAQ'
},
Id: 'a0C7X0000056x8YUAQ',
Name: 'Lote-6155063',
Guia__c: [ a0Y7X000006RSR9UAO: [Object], a0Y7X000006RSREUA4: [Object] ]
},
a0C7X0000056wmxUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmxUAA'
},
Id: 'a0C7X0000056wmxUAA',
Name: 'Lote-6155062',
Guia__c: [ a0Y7X000006RSR4UAO: [Object] ]
},
a0C7X0000056wmsUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmsUAA'
},
Id: 'a0C7X0000056wmsUAA',
Name: 'Lote-6155061',
Guia__c: [ a0Y7X000006RSQzUAO: [Object] ]
},
a0C7X0000056wmnUAA: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmnUAA'
},
Id: 'a0C7X0000056wmnUAA',
Name: 'Lote-6155060',
Guia__c: [ a0Y7X000006RSQpUAO: [Object], a0Y7X000006RSQuUAO: [Object] ]
},
a0C7X0000056wmYUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmYUAQ'
},
Id: 'a0C7X0000056wmYUAQ',
Name: 'Lote-6155059',
Guia__c: [ a0Y7X000006RSQLUA4: [Object], a0Y7X000006RSQQUA4: [Object] ]
},
a0C7X0000056wmTUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmTUAQ'
},
Id: 'a0C7X0000056wmTUAQ',
Name: 'Lote-6155058',
Guia__c: [
a0Y7X000006RSQGUA4: [Object],
a0Y7X000006RSQVUA4: [Object],
a0Y7X000006RSQaUAO: [Object],
a0Y7X000006RSQfUAO: [Object],
a0Y7X000006RSQkUAO: [Object]
]
},
a0C7X0000056wmOUAQ: {
attributes: {
type: 'GRD__c',
url: '/services/data/v53.0/sobjects/GRD__c/a0C7X0000056wmOUAQ'
},
Id: 'a0C7X0000056wmOUAQ',
Name: 'Lote-6155057',
Guia__c: [ a0Y7X000006RSQBUA4: [Object] ]
}
]
但是当我尝试做一个循环时没有任何反应,我这样做是因为在执行过程中我需要添加新的键,比如 Guia__c 并且在 Guia__c 里面我需要放我是新的,这已经发生了,但问题是循环,当我尝试将数组转换为字符串时,什么都没有 returns
Object.values(mapGRD__c)
有必要解决这个问题
像这样:
for(let objectGRD__c of Object.values(mapGRD__c)) {
...Logic
}