I want to have only name of person and
# 🌎general
b
I want to have only name of person and date instead of this format, how can I achieve it?
m
I think you should be able to say {{workflow.name.first}} {{workflow.name.last}} (assuming the object you are printing out is workflow.name)
Could you send the text you are printing?
It will be easier to debug
b
Thank You, @workflow.capturename, for booking your oppointment at @workflow.captureDate. We will be contacting you shortly at the email you provided us.
m
I think you may be able to say @workflow.capturename.first
b
Thanks for infor and I also want time formati
m
@workflow.capturename.last
b
time format to be changed as time is not correct
m
Hold pls on the time format
b
ok
it is not working
Thank You, @workflow.capturename.first, @workflow.capturename.last for booking your oppointment at @workflow.captureDate. We will be contacting you shortly at the email you provided us.
m
I think you need to use {{workflow.capturename.first}} formating
What do you want the date to look like?
{{workflow.captureDate.toLocaleDateString("en-US")}} will give you a readable date like: "March 8, 2023"
b
name format is not working
Thank You,{{@workflow.capturename.first}} , {{@workflow.capturename.last}} for booking your oppointment at @workflow.captureDate. We will be contacting you shortly at the email you provided us.
I think you are using this person object. Is this in a text box?
b
yes
m
Testing it out myself now
You need double curly brackets
{{workflow.captureName.first}}
Headed to bed soon but wishing you lots of luck 🙂
b
yes it worked , thanks
m
Yay!
b
😄
@microscopic-beach-25814 hey , I have used {{workflow.captureDate.toLocaleDateString("en-US")}}, it works fine on emulator in botpress studio but when I publish bot and actual window of bot appears , then date is not shown as same line is printed {{workflow.captureDate.toLocaleDateString("en-US")}} however I have used curly braces. Is there any other way to solve it? Looking forward to response
m
I would look up other ways to make the date the format you want it to be and try different ways until it works.
You could try something like this: console.log(event.toLocaleDateString('en-US', "MMM, DD, YYYY"));
(If you look on the left side you can also try some other options for transforming the dateObject into a string)
Much luck to you!
b
@microscopic-beach-25814 I am getting results in emulator as I am using {workflow.captureDate.toLocaleDateString("en-US")}}, here is attached photo image.png but when i publish it and share it, it is not showing proper date as shown in error.png , I have gone through all methods in website but problem is not resloved. please go through it by yourself or is any other way than using "LocaleDateString". Thanks
m
@mysterious-greece-6693 Is this a known bug?
b
@adorable-whale-86571 please help me as I am working on it for 5 days
@adorable-whale-86571 I will be very thankful
a
You need to check on the bottom-left of the screen when editing your bots
and check the type of data that the variable you are trying to print has
or just delete the card where you are capturing the user's name and create a new one where it's just raw input
b
@adorable-whale-86571 i am working on date
@adorable-whale-86571 I am getting correct date in emulator but in bot it is showing error
a
date will always print also time including seconds, you would need to format the variable in a execute card
b
could you please tell the procedure as I am working on it for 5 days
@adorable-whale-86571
a
now that i look at it twice
show the workflow
and the variables of your bot
b
Here is the card where message is being printed
Here is date time card
@adorable-whale-86571
a
delete that part {{{workflow.captureDate.toLocaleDateString etc etc and make an execute card right before that card and put this
Copy code
javascript
/// first you must create captureDate as a date variable
workflow.captureDate = workflow.captureDate.toLocaleDateString("en-US")
/// but then workflow.captureDate will be a date variable so it will print what happened before: "2023-09-28T00:00:00.000Z"
workflow.captureDateFormatted = workflow.captureDate.toISOString().substring(10);
/// you must also remember to create captureDateFormatted as a string variable in your bot
then you can just replace what you deleted with {{{workflow.captureDateFormatted}}}
b
should i create separate card before Thankyou card
a
yes create an execute card
and put those two lines
create the variables in your bot
with the right data type
variables are in the bottom left of your screen when editing your bot
b
like this way
If it is possible for you, can we do 5 mins meeting , it would be very helpful. thanks
@adorable-whale-86571
a
i need to see the execute card you did
and the variables in your bot
specifically the ones you needed to create that you will use in your execute card
b
could we arrange meeting it will be easy to go through bot in real time
a
if you have windows we can hop on quickassist
b
yes please code
send'
a
pm
b
??
a
i'm not sharing the code publicly here, i sent you a pm
let me know if it worked
b
here is the problem
it is not working
a
check the log
b
help centre shared me this solution, if it can help you to solve the problem
log??
@adorable-whale-86571 Thanks, it worked, again thanks for your time and help. I appreciate it.
a
great happy to hear that
how did you solve it at the end?
b
it was issue with code and variable
f
mine returns nothing to string 😦 , how did u solve this
5 Views