cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
YDDecs
Level: Powered On

Getting "####" from variable when there is Replace function

Hello,

 

I have created small function which is fetching data from Dynamics 365 Number sequence table which is working fine. The problem I have is that the end result instead of numbers "123456" is being displyed with "#####123456".
It is Text function and automatically place holder is being assigned.

 

Please see the below screenshot:
func_var.PNG

The variable which filed is displying is "GlbNextSalesOrdeLines" , the Format of the Number Sequence is "######" , but this is why i have place the Replace function as well.

Could anybody pointout where is my mistake in the formula?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Getting "####" from variable when there is Replace function

Hi @YDDecs 

 

In that case if the format is fixed to six digits, you can use directly use the expression:
Text(GlbNextNumber,"[$-en-US]000000")
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
8 REPLIES 8
Super User
Super User

Re: Getting "####" from variable when there is Replace function

Hi @YDDecs 

 

Can you try out the formula:
Replace(GlbSequenceFormat ,Len(GlbSequenceFormat)-Len(GlbNextNumber)+1,Len(GlbNextNumber),Text(GlbNextNumber,"[$-en-US]000000"))
 
If this differs, can you please share the values that are stored in GlbSequenceFormat and GlbNextNumber? We can construct the formula based on that.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

YDDecs
Level: Powered On

Re: Getting "####" from variable when there is Replace function

Hi @yashag2255 ,

 

Thanks for the responce.

The suggested formula breaks as Len expects text, where in the sequence table are number (at least this is the error).

Break-down if my formula is:

Set(GlbNumberSequenceFormat,LookUp(SequenceTables,NumberSequenceCode="Inve_162",Format));

- setting variable name "GlbNumberSequenceFormat" , which is fetching the format which is "######",  data source is "SequenceTables" and in it i am looking for the NumberSqeuenceCode "Inve_162"

Meaning that this will register the value of the format being "######" - 6 digits preconfigured in Dynamics365 for finance.


Set(GlbNextNumber,LookUp(SequenceTables,NumberSequenceCode="Inve_162",Next));

- setting variable name "GlbNextNumber" for LookUp in the data soruce which is "SequenceTables" for the Sequence code of "Inve_162" for the "Next" number which will be generated. The next number in the sequence table filed is dispalyed with 5 digits only. But in the field of Sales Orders it should be 6 digits as per the format, so the next line is for that

Set(GlbNextSalesOrderLines,Replace(GlbNumberSequenceFormat,6,6,Text(GlbNextNumber,"[$-en-US]000000")));

-setting variable name "GlbNexSalesOrderLines" where I want to replace the value of "GlbNumberSequenceFormat" variable and add extra digit of 0 to it. , so it gets correctly populated in the Sales order filed and the systems recognizes it as valid one.

 

Let me know if my explanation of the formula is not clear, I will try to elaborate.

 

Thank you! 

Super User
Super User

Re: Getting "####" from variable when there is Replace function

Hi @YDDecs 

 

Can you try to update your expression as:
 
Replace(GlbSequenceFormat ,Len(Text(GlbSequenceFormat))-Len(Text(GlbNextNumber))+1,Len(Text(GlbNextNumber)),Text(GlbNextNumber,"[$-en-US]000000"))
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
YDDecs
Level: Powered On

Re: Getting "####" from variable when there is Replace function

Hi @yashag2255 ,

 

Thanks again, I guess my skills with formating need some work still.

 

So the formula works, but now i am receiving as result one "#" , which is less than the previous 5 "#" , but it is still not the value which needs to be displayed. 

Basically I looking for way to remove this hastag "#" and I don't know how and why it is appering.

hashtag.PNG

Super User
Super User

Re: Getting "####" from variable when there is Replace function

Hi @YDDecs 

 

The solution provided was according to display # in the result. Are you looking for just displaying the number? Please share the exact value that you want to display, and we can rebuild the formula accordingly.
 
If you do not want to display #, please share more details about how this GlbNumberSequenceFormat will be used?
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
YDDecs
Level: Powered On

Re: Getting "####" from variable when there is Replace function

@yashag2255,

 

So the "#" is part of the format of the NumberSequence, but I am looking to display on the Next generated value which in the number sequence code is with 5 digits (skipping the "0") and i just need to add 0 in the beginng on of the numeric value, so it will be recognized as valid.

 

GlbNumberSequenceFormat is used to set the format of the end value, which is predefined in the sequnce table to be "######" which is reading it as 6 digits.

Super User
Super User

Re: Getting "####" from variable when there is Replace function

Hi @YDDecs 

 

In that case if the format is fixed to six digits, you can use directly use the expression:
Text(GlbNextNumber,"[$-en-US]000000")
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
YDDecs
Level: Powered On

Re: Getting "####" from variable when there is Replace function

@yashag2255,

 

Thanks for poinitng out. Apperantly I was trying to make it more complicated than it should be.

 

So yeah now it works perfect , no hastags Smiley Happy

 

Thanks again and have a nice day!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 182 members 4,617 guests
Please welcome our newest community members: