Hi Thomas,
in the linked values, there is an object based on the destination schema. Usually, I put console.log(doo.model.<[Documents (doc_ToProject)]>.value)
to check the structure in the console, so I can use it in my script.
Can that work for you?
Regards
Michal
Well console log works in right way, but I still have no idea how can I get value of one column from linked schema.
Problem is, when I just create new row in schema Documents and then I want to choose row from Projects (which is linked/related to Documents) so I have there two columns (ID and Name). Then, when i pick whatever row and use this JS:
var CisloPrirazeni = doo.model.<[K zakƔzce (dokumenty_kZakazce)]>.value;
doo.model.<[PÅidruženo k (dokumenty_PridruzenK)]>.value = CisloPrirazeni;
so it will be saved just as [object object], probably cosā of an array or something?
So I would like to know how to set var CisloPrirazenĆ and save just that value what I want to (ID).
Note: In schema Projects I have set Schema item internal name and put on Include in lookup selected value at both columns (ID even NAME).
Hi Thomas,
When you do console.log(doo.model.<[K zakƔzce (dokumenty_kZakazce)]>.value)
in a Tab āOn Model Changeā
you should receive the object with its properties into a console output window (F12).
Letās say, that you can see something like;
{
id: "6f94bf6e-800e-4f13-96a3-c18a310e7e82"
xhivovk02h: 'myId',
weoriuklkdf: 'Name of the XY',
...
_$$changed: true
_$$originalId: null
...
}
It depends on your internal property names (you are able to change them in schema items).
Then, when you know the name of your property, you are able to use it like this: doo.model.<[PÅidruženo k (dokumenty_PridruzenK)]>.value = CisloPrirazeni.xhivovk02h
In case my explanation is not clear, can you append the output from console.log(doo.model.<[K zakƔzce (dokumenty_kZakazce)]>.value)
to the question, please?
Or, you can contact me directly and we can arrange a call
michal.cumpelik@tabidoo.cloud
Regards
Michal
Great!
So I guess you changed that to something like
var CisloPrirazeni = doo.model.<[K zakƔzce (dokumenty_kZakazce)]>.value;
if (CisloPrirazeni)
doo.model.<[PÅidruženo k (dokumenty_PridruzenK)]>.value = CisloPrirazeni.zakazky_id;
else
doo.model.<[PÅidruženo k (dokumenty_PridruzenK)]>.value = null;
or doo.model.<[PÅidruženo k (dokumenty_PridruzenK)]>.value = (CisloPrirazeni ? CisloPrirazeni.zakazky_id : null);
Hi @micu,
I tried to insert these instructions as you wrote, to assign a field of a linked table, but it generates an error, where am I wrong? The name of the field is āCONVENTIONEDā:
var cnv= doo.model.<[CONVENZIONATO (convenz)]>.value; //Linked Field
doo.model.<[CNV (xpdyokzm99)]>.value == āā; // if true
doo.model.<[CNV (xpdyokzm99)]>.value = cnv.CONVENZIONATO;
ERROR: undefined is not an object (evaluating ācnv.CONVENZIONATOā)
Thanks for the answer @micu , but I have not come to the head and opening console.log on the browser I get continuous errors.
What I want to achieve is that if a TEXT type āAā field is NULL or EMPTY it must fill it with the value of a linked field āBā that it contains (field1, field2, field3 of type text). More precisely, if the condition is satisfied, the field āAā must be = ā(field2)ā of the linked table āBā. I hope I was clearer.
doo.model.<[CNV (xpdyokzm99)]>.value == āā; // if true Thank you This works for me, check if the text field is empty, syntax is correct
Thanks for the example you will give me. Greetings
It is pretty dificult just without the case. I would say that something like this can work:
var cnv= doo.model.<[B (link)]>.value;
console.log(cnv); // check properties during model change in the real form in the console, delete later
if (!doo.model.<[A (text)]>.value && cnv.value) {
doo.model.<[A (text)]>.value = cnv.field1;
}
var cnv= doo.model.<[CONVENZIONATO (convenz)]>.value;
doo.model.<[CNV (xpdyokzm99)]>.value == āā;
doo.model.<[CNV (xpdyokzm99)]>.value=cnv.rag_sociale; It works perfectly
Obviously rag_sociale is the name of the internal field that I assigned in the linked schema!
Now Iāll also check your code, then Iāll let you know if it works. Thank you very much.