Warning on button coding: "Field must return dynamic values..."
Hi there!
After some trial and error, I came out with this coding that works as expected but I can't get rid of the warning sign saying: Field must return dynamic values...
I'm generating a new record from table Asiento to a different table (Gastos) where there are two dynamic choice fields working in cascade (depending on the selection of supplier "Proveedor" and pointing to table "Servicios Contratados") . This is my coding (I simplified it leaving the issue in question only):
let asiento := this;
let gasto := (create Gastos);
gasto.('Fecha Doc.' := asiento.'Fecha Asiento');
gasto.('Nro. Factura' := "S/Justificante");
gasto.(Proveedor := 34);
gasto.('Categoría' := first(select 'Servicios Contratados' where Proveedores = 34));
gasto.('Subcat.' := first(select 'Servicios Contratados' where Proveedores = 34));
let servicio := (create Servicios);
servicio.(Concepto := asiento.Movimiento);
servicio.('Base Imponible' := asiento.Importe * -1);
servicio.(Gastos := gasto)
The thing that troubles me is that it works as expected:
So, I'm totally lost on why it works the first time and just after it gives me this error/warning.
I've also tried with record(... function but it doesn't select the values.
Thanks for any help on this!
5 replies
-
can you post a sample DB, one without personal data?
-
You can change first to number and it should work.
gasto.('Categoría' := number(select 'Servicios Contratados' where Proveedores = 34));
When you do a select you get back table id and record id. So then we have to convert the nid info into plain numbers. It looks like Ninox doesn't like table/record data being passed to make a selection of a dynamic field. I thought you could, but this error message shows otherwise.
On a side note, when referencing new record variables you can simplify the code by doing:
gasto.( 'Fecha Doc.' := asiento.'Fecha Asiento'; 'Nro. Factura' := "S/Justificante"; Proveedor := 34; 'Categoría' := number(select 'Servicios Contratados' where Proveedores = 34); 'Subcat.' := number(select 'Servicios Contratados' where Proveedores = 34) );
This method also can be done when creating json.
Content aside
- Status Answered
- 9 mths agoLast active
- 5Replies
- 105Views
-
2
Following