HI:
I'm tring to automaticly create new records on a sharepoint list(list_a), base on the quantity and values of a filter gallery(Gallery4).
This next example works fine, creating the records I want each one with the one of the values(value_1) of the Gallery4
ForAll(
Gallery4.AllItems;
Patch(
'list_a';
Defaults('list_a');
{value_1=Subtitle3.Text)}
)
)
Now I want to substitude value_1 with a lookup value(lu_value) to another list, si I have tried something like this:
ForAll(
Gallery4.AllItems;
Patch(
'list_a';
Defaults('list_a');
{lu_value=Subtitle3.Text)}
)
)
With htis, I get an error saing the lu_value is expecting a record and is getting a number, so i have tried this:
ForAll(
Gallery4.AllItems;
Patch(
'list_a';
Defaults('list_a');
{lu_value=Lookup('list_b'; ID=Subtitle3.Text)}
)
)
With this I get an error, saying that lu_value is expecting another kind of record, though lu_value is a lookup field to "list_b".....
Any clue how to solve this?
Thanks in advance.
Solved! Go to Solution.
Hi @cholopa ,
A Lookup field is actually a Table consisting of the ID of the record chosen in the "other" list and the value in the nominated field that record. To Patch to a Lookup field, you need both of those values.
Currently it seems you have a free-form Text field, so for a start unless the value put in there exactly matches one of the values in the Lookup column, you will not be able to Patch it. If it does match, the syntax would be
ForAll(
Gallery4.AllItems;
Patch(
'list_a';
Defaults('list_a');
{
lu_value:
{
Value:Subtitle3.Text;
Id:
Lookup(
'list_b';
FieldName=Subtitle3.Text
).ID
}
}
)
)
FieldName is the field in list_b being looked up.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Notice in our country we use ";" instead of ","
Hi @cholopa ,
A Lookup field is actually a Table consisting of the ID of the record chosen in the "other" list and the value in the nominated field that record. To Patch to a Lookup field, you need both of those values.
Currently it seems you have a free-form Text field, so for a start unless the value put in there exactly matches one of the values in the Lookup column, you will not be able to Patch it. If it does match, the syntax would be
ForAll(
Gallery4.AllItems;
Patch(
'list_a';
Defaults('list_a');
{
lu_value:
{
Value:Subtitle3.Text;
Id:
Lookup(
'list_b';
FieldName=Subtitle3.Text
).ID
}
}
)
)
FieldName is the field in list_b being looked up.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi:
Work fine!!!
Thanks very much!!!!
Just a notice, I had to also add value to Subtitle.Text for it to work properly (to change a text for a number)
Here is the final code(remember ";" is subsitute by "," in my country.:
ForAll(
Gallery4.AllItems;
Patch(
'Mnto equipos basicos';
Defaults('Mnto equipos basicos');
{
LU_equipo:
{
Value:LookUp(Equipos;ID=Value(Subtitle3.Text)).codigo_x0020_cliente;
Id:LookUp(Equipos;ID=Value(Subtitle3.Text)).ID
}
}
)
)
User | Count |
---|---|
171 | |
95 | |
74 | |
72 | |
58 |
User | Count |
---|---|
215 | |
166 | |
96 | |
93 | |
74 |