how do we access values from an object data type in a Function
ex: i have stored a date by date picker in a variable and trying to do calculations on it
have tried : data.variable.test.value.date – not working
how do we access values from an object data type in a Function
ex: i have stored a date by date picker in a variable and trying to do calculations on it
have tried : data.variable.test.value.date – not working
It should be variables. Here are some samples:
data.variables.test.value.date
data.variables.test.value.month
data.variables.test.value.year
data.variables.test.value.day
still not working
it is working fine for other data types but not working for object type data
@Kanchepalli_Harsha_V @academy.yellow.ai
Please suggest on this
First, declare the dateObj
variable as follows:
let dateObj = data.variables.test;
Next, to extract other values from it, use:
let userInputDate = dateObj.value.date;
let userInputMonth = dateObj.value.month;
These lines of code will help you access the specific values within the dateObj
object.
for now I have tried creating it this way
: checkindate is a object variable containing datepicker output
: after running function I am printing its output but its printing blank
return new Promise(resolve => {
// Your logic goes here
let a = data.variables.checkindate;
let b = a.value.date;
resolve(b);
});
Please share you contact so that i can share access + we can connect and resolve
could you please give me a sample code , output
with a screenshot of it
also the input details
@Srinivas @Sai_Kumar_Singaram could one of you help us here with this, please?
return new Promise(resolve => {
// Your logic goes here
let userInput = data.variables.dateList;
console.log(userInput)
console.log(userInput.value.date)
let selectedData = userInput.value.date
resolve(selectedData);
});
Note: If you want to capture the date store the response in variable of type number.