Text working as Math Functions instead of Text
Question
Application Type
Reactive

I'm working to get data from JSON and then converting it to text to display as a label for a line chart. The data is coming back correctly but I expected it to return as text and not work as a mathematical function.


Is there a different way I should be writing this as to display "07/2021" instead of dividing the Month by the Year?


Hello Everyone,


I have found the issue, I needed to add quotations around the converted Month and Year. I believe the code was running the Integers to a math equation and then converting the final output to a Text variable. I've included the updated If Statement I'm using to assign the varaibles.


Hi Alex Barrington,

It is working perfectly for me

LongIntegerToText(Value1)+"/"+LongIntegerToText(Value2)

I have attached the oml and url here.

Can you attach the sample oml. so, that we can able to solve this.

Regards,

Ellakkiya.S 

ReactivetestappEllak.oml

Hi Alex Barrington,

Maybe your problem is the one marked in the image:

In my tests it works perfectly

LongIntegerToText(InDay) + "/" + LongIntegerToText(InMonth) + "/" + LongIntegerToText(InYear)

Publish:

I hope this helps you

Best Regards,

Hello Alex,

It looks like you are concatenating the month's value twice into the else condition. Please refer the below screen shot. I have attached a sample OML for your ready reference where you can click on the submit button with or without value to get the values.

Thanks & Kind Regards,

Sachin

TestApp1.oml

Hello Everyone, I unfortunately can't include an OML file for this as it's a business file and I don't want to include any data that could be sensitive.


None of these solutions have worked for me, 

@Sachin Waghmare - the Months variable is actually an output variable and I'm using it to iterate the loop putting all of these Month/Year variables into an array.

 

This is the output I'm receiving for clarification.

As you can see the labels on the X axis are all returning as math equations, so for an example it looks like "8/2020" and thinks it should be 8 divided by 2020 instead of displaying it as "8/2020"

Here is the Highcharts JSON I'm using for the Line Chart as well.

Alex Barrington,

Don't worry, I can understand your worry about client data. Can you help us to create a sample oml with similar data? and apply the same logic as you did in your business oml. it would give us a better idea. 

AJ


Hello Everyone,


I have found the issue, I needed to add quotations around the converted Month and Year. I believe the code was running the Integers to a math equation and then converting the final output to a Text variable. I've included the updated If Statement I'm using to assign the varaibles.


Hi Alex,

you are building a text string representing a comma seperated list of categorie labels for your x axis, but as you are doing it now, your category array will probably look something like 

[8/2020,9/2020,10/2020,11/2020], and the highcharts javascript will probably see this as a list of numbers.  You are not adding any quotes !

Dorine



EDIT : Ah, i see you have come up with the answer already, well done.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.