英文:
Foundry Palantir - Typescript function : update valeur on columns
问题
@OntologyEditFunction()
public async deletevaluetable(
objectpart: ObjectPartsNew[],
ID?: string,
level?: string,
responsible?: string,
description?: string,
): Promise<void> {
function deletevaluetable() {
var manual;
for (var i = 0; i < objectpart.length; i++) {
manual = objectpart[i];
var updates = 0;
const properties_dict: manualUpdate = {
"manual": ID,
};
.....
}
}
}
英文:
I will like a help for a typescript function on ontology object.
I would like to write a typescript program that takes a dataframe as input.
When I remove a value from a row in a column, the values in other columns change to null.
For example, this a dataframe
ID | level | responsible | description |
---|---|---|---|
A12 | level2 | NG34Jean | Sheet |
B15 | level5 | NG90Elis | Bellow |
C67 | level4 | NG64Matire | Clamp |
H65 | level3 | NG45Louis | Cubical |
J90 | level0 | NG08Marie | Blech |
For the ID = B15, I would like to remove its level ie "level5" hence the values of "responsible" and "description" egal to "Null"
For the ID = H65, I would like to remove its level ie "level3" hence the values of "responsible" and "description" egal to "Null"
Here is the dataframe at the end
ID | level | responsible | description |
---|---|---|---|
A12 | level2 | NG34Jean | Sheet |
B15 | No value | null | null |
C67 | level4 | NG64Matire | Clamp |
H65 | No value | null | null |
J90 | level0 | NG08Marie | Blech |
@OntologyEditFunction()
public async deletevaluetable(
objectpart: ObjectPartsNew[],
ID?: string,
level?: string,
responsible?: string,
description?: string,
): Promise<void> {
function deletevaluetable() {
var manual;
for (var i = 0; i < objectpart.length; i++) {
manual=objectpart[i];
var updates = 0;
const properties_dict: manualUpdate = {
"manual": ID,
};
.....
}
}
}
答案1
得分: 1
我认为你可能混淆了一些概念,例如编辑本体不是一个Spark任务,因此没有数据框架。你直接在实时搜索和索引系统中操作单个对象实体。你有没有可能展示一下实际执行这些更改的代码呢?我怀疑你可能只是用新的实体覆盖了之前的实体,并且减少了一些列。
即,你可能想要这样做:
const editedObjectProperties: ObjectPartsNew = {
ID: ID,
level: "No value",
responsible: objectpart[i].responsible,
description: objectpart[i].description
};
英文:
I think you are confusing some concepts, for example editing the ontology is not a spark job, thus there are no dataframes. You're directly manipulating an individual objects entity in a real time search and indexing system. Any chance you can show the code that actually performs the changes? I have a suspicion you are just overwriting the previous entity with a new one with less columns.
i.e. instead of this:
manual=objectpart[i];
var updates = 0;
const properties_dict: manualUpdate = {
"manual": ID,
};
You probably want:
const editedObjectProperties: ObjectPartsNew = {
ID: ID,
level: "No value",
responsible: objectpart[i].responsible,
description: objectpart[i].description
};
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论