How using getCurrentItem with Reference fields ?

Hi Wixien(ne)s
Using the getCurrentItem function within a database ,i can’t get the value of the field key createdBy : Each time result is [object Object] …

By the way I have no problem to get values of the other fields of the dataset. The only difference i see is that the createdBy field is a " Reference field " . So what’s wrong in this case ? and how can i get the CreatedBy value ( the Email address) ?

Thanks by advance for your helps or ideas .

Eg of code using :

$w.onReady(function () {

$w("#dbJobs").onReady(() => { 
	var currentItem = 	$w("#dbJobs").getCurrentItem(); 

$w("#myText").text = "All the items = " +  "Title: "+ currentItem.title  + "  Description : "  +  		 
     currentItem.description + "  zip : "  +  currentItem.zip + "  CreatedBy :" + currentItem.createdBy  
	
      console.log("All the items =  " + $w("#myText").text ) 
}); 

});

eg. result of console.log() for the Job Id 7
All the items = Title: Title2 Description : Desc2 zip : 4321 createdBy : [object Object]
NB: all is ok except for the Reference Field “createdby” :disappointed_relieved:

For interested people i found the f…solution as below :

The source of the confusion:
If you write :
console.log (“Header :” + currentItem.createdBy)
the return is : Header: [object] [object] // the problem mentioned

but when you don’t write the " header " in the console.log as
console.log (currentItem.createdBy) //
all is working and the result displaying is an array {…} containing all the infos of the other database linked by the reference field

eg.
{ …}
_id: “c290a7b3-c44c-4d27-ae45-2455ca824aj2”
_owner: “c290a7b3-c44c-4d27-ae45-2455ca824aj2”
_createdDate: “2020-07-10T23: 51: 03.944Z”
emailAddress: “johnDoe@gmail.com

So for retrieving the email address i need through the reference field :" Createdby " the code is something like:
let currentItem = $ w (“# dbJobs”). getCurrentItem ();
let EmailAddress = currentItem.createdBy.emailAddress;

Hope it will help

Thx to myself …

1 Like

Hello Felix,

you are the best :rofl:

Everytime when i open your issues and wants to help, i just see → “allready done, thx to myself” :grin:

You don’t need help, you just need more time to think about your own issues :wink:

Hello , thx a lot for your support . But unfortunaly i have not the time . :frowning: For a beginner here it’s the hell
At each step Wix code is full of trap and it"s very difficult here to found cleary basics informations . Examples given are very fragmented and are not representative of how to used them in reality . I think it miss something to agregate that. Almost of questions of this forum are not solve and it became an obstacle course to found something right .
I have a look on your wix website link ( https://russian-dima.wixsite.com/meinewebsite ) and i recommend it because you work in this way to show only the working solutions.
Thx to you for that.

Thx, i do my best, to help people who are new to all this stuff. I was also a BEGINNER and it’s not too long ago :grin: and yes i know how you feel.
But you will reach one day the point, where you will understand something, you will understand how to use CORVID and then everything will be a little easier.
My suggestion to you, take a look to some videos of Andreas Kivby, in one of his videos he shows how to work right with CORVID and his explanation on his live example in the video, will open your eyes to the world of CORVID :wink:

I needed about 6-Month to understand all that, but you can do it faster, with the help of this good man with his good stuff. And there are some more good guided youtube-stuff, for example from “TotalyCodable”. You can find this stuff also in some of my examples, like here …
https://russian-dima.wixsite.com/meinewebsite/blank-21

On my opinion, the most important thing here in CORVID is to understand, how to work with databases and know the concept of dynamic-pages respectively datasets. Everything is turning about DATABASES :grin: and additionaly repeater.

And when you know the difference between FRONT-END and BACK-END and know the JavaScript-Syntax, then you are already on a very good way to get upgraded and get a new LEVEL of CORVID-knowledge.

In my case, examples helped me a lot.

There are also very good examples given by Wix, which you will find in the “Link-Collection” on my site and some more good stuff.:wink:

So i wish you good luck, never give up. I am also still a LEARNER and i am learning by doing. I am learning by helping other (and it is a really good learn-tactic) just a tipp for you at the end of my little novel xD.