JOYE Posted February 15, 2019 Report Share Posted February 15, 2019 Hello, I'm a beginner in software development. How use the box String to Num ? What is the FACTOR ? Thank you. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted February 15, 2019 MVP 2022 Report Share Posted February 15, 2019 @Cara Bereck Levy, as far as I can tell, there is absolutely nothing on this function in the help file. Can you help? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted February 15, 2019 MVP 2022 Report Share Posted February 15, 2019 By the way, the answer to your question, @JOYE, is that FACTOR is how you deal with the decimal placement since you are converting the string representation to an integer. If the string looks like this: "123.45", then you would use a factor of 100 to result in an integer value of 12345. You can then display this integer number on the HMI screen and identify where to place the decimal. If you use the number in calculations, you would need to account for the fact that the number has been multiplied by 100 and deal with that properly. Quote Link to comment Share on other sites More sharing options...
hotwires Posted February 16, 2019 Report Share Posted February 16, 2019 I had a crash course in UniLogic string to num conversions (formatting/handling). You have to remove leading spaces and trailing non numeric characters if I recall correctly. The Visilogic string to num FB is more flexible as to what it will convert. If your ASCII string is purely numeric characters you should be Okay. If you need a subroutine to strip off other characters let me know. I could share a snippet of code I used. 1 Quote Link to comment Share on other sites More sharing options...
JCristian Posted June 27, 2019 Report Share Posted June 27, 2019 On 16/2/2019 at 10:36, hotwires said: Tuve un curso intensivo en la cadena UniLogic para numear las conversiones (formateo / manejo). Tienes que eliminar los espacios iniciales y los caracteres no numéricos finales si recuerdo correctamente. La cadena de Visilogic a num FB es más flexible en cuanto a lo que convertirá. Si su cadena ASCII tiene caracteres puramente numéricos, debería estar bien. Si necesita una subrutina para quitar otros caracteres, hágamelo saber. Podría compartir un fragmento de código que utilicé. Could you help me? I need to convert a string into a number. My string has a decimal point, for example, "34.123" and sign "-" when the reading is negative Quote Link to comment Share on other sites More sharing options...
hotwires Posted July 4, 2019 Report Share Posted July 4, 2019 If you are still needing help, I'll look through my files and see if I can post a snippet (photo) of the logic I used to convert ASCII string from a gram scale to an integer for comparison to a tolerance (window) and give an output if weighed part is "bad". Back when I worked on this the help section was sparse and (even though I would consider myself an intermediate programmer ((on a scale of: novice, intermediate, advanced, and expert)) it took me a considerable amount of time to reach an efficient solution. See photo below for a start. The - sign will need a little addition logic. Let me know if you need help with that part. 1 Quote Link to comment Share on other sites More sharing options...
tanaka Posted October 22, 2021 Report Share Posted October 22, 2021 On 2/16/2019 at 6:36 PM, hotwires said: I had a crash course in UniLogic string to num conversions (formatting/handling). You have to remove leading spaces and trailing non numeric characters if I recall correctly. The Visilogic string to num FB is more flexible as to what it will convert. If your ASCII string is purely numeric characters you should be Okay. If you need a subroutine to strip off other characters let me know. I could share a snippet of code I used. Hi @hotwires would you mind sharing your subroutine on stripping off some characters in Unilogic to use the string to num block Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.