Solved

How to delete first 4 numbers of autofilled field

  • 2 August 2022
  • 2 replies
  • 46 views

Hello

I would like to ask this:

 

I have a field that is automatically filled in (javascript) depending previous dropdown choice. But it is always a number lets say 1111 1111.

My intention is to delete first 4 numbers of the field by String format - I have tried fn-Remove(Something, 1, 4) but that doesnt work.

 

What should I do to make it work please?

icon

Best answer by MegaJerk 4 August 2022, 08:25

View original

2 replies

Userlevel 5
Badge +14

Question 

1. Do you want the Autofilled value of "1111 1111" to instead produce only "1111" 


 


Or


 


2. Do you want the Autofilled value of "1111 1111" to remain there, and instead just want to take the last n number of digits of that value to use somewhere else? 


---


 


If it's the 1st one, then we'd need to see the code being used to autofill the control. 


 


If it's the second one then you can just use SubString to get the values starting at the position you care about up to some arbitrary length of characters. 


 


example


 


I have two controls. A Single Line Text called "someNumbers" and a Calculated Control:



 


SLT Control is configured with a default value of some numbers sort of like how you have shown:



 


 


The formula for the Calculated Control is as follows:



 


All substring does is take a string, takes a starting position, and then returns up to the number of characters you specify


 


So for the string "1111 1234", I'm telling it to start at the 4th position (the last 1), and then get 10 characters to the right of that. If you don't know how many characters there are after that, or only need to get a certain amount of specific characters after that, then we'll have to use a different method, but going only off of what you've posted, this may work depending on your circumstances. 


 


Let me know. 


 


 

Thanks for your answer! Second option solved the case.

Reply