Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Qlik proffesionals!
I have the next problem:
Here is an example of what the GET retrieves me (and here, you can clearly see VISUALY the role assigned to each person, VISUALY):
And this is my code:
For Each vCultivoFincaID in FieldValueList('ENLACE')
Let vURL = '"http://ws.visualnacert.com/vnwebservices/user/$(vUserid)/v3/crops/' & SubField($(vCultivoFincaID), '.', 1) &'/farms/' & SubField($(vCultivoFincaID), '.', 2) & '/farmpersons"';
Trace $(vURL);
RestConnectorMasterTable:
SQL SELECT
"__KEY_root",
(SELECT
"idFinca",
"idPersona",
"nombre" AS "nombre_u0",
"email",
"telefono",
"__KEY_data",
"__FK_data",
(SELECT
"idRole",
"nombre",
"nombreInt",
"__FK_roles"
FROM "roles" FK "__FK_roles")
FROM "data" PK "__KEY_data" FK "__FK_data")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION ( URL $(vURL));
[Farmpersons_data_roles]:
LOAD
[idRole],
[nombre] AS [nombreRole],
[nombreInt],
// SubField($(vCultivoFincaID), '.', 2) AS idFinca,
[__FK_roles] AS [__KEY_data]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_roles]);
[Farmpersons_data]:
LOAD
[idFinca],
[idPersona],
[nombre_u0] AS [nombre],
[email],
[telefono],
SubField($(vCultivoFincaID), '.', 1) AS idCultivo,
[__KEY_data]
// [__FK_data] AS [__KEY_root]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_data]);
DROP TABLE RestConnectorMasterTable;
Next vCultivoFincaID;
How can I join these tables without a common thing??
Is this possible?
Thanks in regards,
Diego.
you are looping through all the different farmers, there should be an extra key in your query and resulting tables based on
vCultivoFincaID
maybe the api response can do it by itself:
check the key generation strategy...
Isn't __KEY_Data the link between the tables? Or __FK_data that becomes __KEY_root in Farmpersons_data (but you commented that out for some reason).
Hello Henrikalmen,
Yes, __KEY_Data SHOULD be the link that solves me this issue, but as I said before:
Here is an example of what the tables show me with the same filters (idCultivo: 12926 and idFinca: 2):
As you can see, it doesn´t make the correct relation, it should only appear me a few Roles, but instead it shows me ALL the Roles this people have had in ALL the farms and crops. Even if I filter with a person, it still shows me every role it has had historically.
Also I comment __KEY_Root because is irrelevant, it only has a 1 in all values.
Thanks.
you are looping through all the different farmers, there should be an extra key in your query and resulting tables based on
vCultivoFincaID
maybe the api response can do it by itself:
check the key generation strategy...
Yeah that worked!
I didn´t knew you could change the key generation, now it does make a completly unique key so the relation is established.
Thanks a lot!
Diego.