I was looking for an solution.Any way to Changing the font colour of partial texts based on start and end index. And the sentence starting and ending index are obtained from collections( API response are stored in collections)
Example context : David visited the restaurant yesterday. David again visited today and hoped to visit again tomorrow
Date Start End
2021/02/10 30 48
2021/02/11 61 65
2021/02/12 91 98
Expected Output: David visited the restaurant yesterday. David again visited today and hoped to visit again tomorrow
To change font colors (and other aspects) you need to utilize the HtmlText control.
So in your example (not sure how the logic relates to your collection data, but I'm sure you have that worked out) your htmltext would be:
"David visited the restaurant <font color='red'>yesterday</font>. David again visited <font color='red'>today</font> and hoped to visit again <font color='red'>tomorrow</font>"
I hope this is helpful for you.
Actually API response i stored in collection will vary based on user filled out in textbox. and also i want to change the font color based on the index values
Let me put this simpler.
For example User enters context that contains yesterday,today,tomorrow like above mentioned example
so api response that im getting will be like
|Date||Start index||End Index|
im storing this api response to collection
so now what im looking for is to change the font color from the index 61 to 65 and 91 to 98 and 30 to 48 only
and my output will David visited the restaurant yesterday. David again visited today and hoped to visit again tomorrow
I am sorry, I am not understanding any connection of start and end index number and a date and users entering yesterday today and tomorrow to anything. There is no connection at all (in my interpretation of your message) to the sentence you are providing. What does 61 to 65 have to do with David visiting the restaurant yesterday, today or tomorrow or anything?
This is how UI looks like. When I click test button it trigger API which identifies date field with starting and ending position in the given context and api response (dates) stored in collection
now im looking for solution to highlight the dates in given context using start and end index from collection
I would suggest a Replace function then, but your index numbers do not correlate to the text.
Based on your image, 29 to 37 is "t yester" and 20 to 24 is "rest"
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!