How to put a digit in a specific tag position

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
Jesus
Posts: 5
Joined: Fri Jul 19, 2013 6:33 am

How to put a digit in a specific tag position

Post by Jesus »

In the first way, sorry for my poor english.

I need to put a digit in a specific positon on string (or integer, but i think that is more viable do this in a string). For exemple, i have the tag String1, 6 char long, and i want to put a 1 in the position 3 of the string, and a 0 in the rest of positions (001000). Other exemple: I have the same String1, and i want to put a 4 in the 2nd position, and a 1 in positions 4 and 6. The rest of the string's charters are 0 (040101).

Thanks, and sorry other time for my horrible english.

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: How to put a digit in a specific tag position

Post by mark.monroe »

You would have to use a C# script to do that. There should be a lot of examples online that show you how to parse and modify strings in C#.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Jesus
Posts: 5
Joined: Fri Jul 19, 2013 6:33 am

Re: How to put a digit in a specific tag position

Post by Jesus »

Is posible, but i'm asking here because i'm need this for a Beijer Screen. I'm not a programmer, and i don't know C# language. Do you can help me?

Thanks.

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: How to put a digit in a specific tag position

Post by mark.monroe »

Unfortunately we can only provide C# support if it relates to iX API function calls. What you want to do is C# specific and is not related to iX Developer. C# is a language that is supported by Microsoft. I would recommend that you go to a programming forum and ask how to parse strings there. Stack Overflow is one such forum.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Jesus
Posts: 5
Joined: Fri Jul 19, 2013 6:33 am

Re: How to put a digit in a specific tag position

Post by Jesus »

Ok, i have a question about iXDeveloper:

I have 6 buttons, and i need record in the same tag if any of this buttons was be presseds. But, in adittion, i need to record in the same tag other posible information (With other buttons). In others words, i need to record two types of informations in the same tag. My question is: I can do this in iXDeveloper without using a enormous chain of conditions?

Jesus
Posts: 5
Joined: Fri Jul 19, 2013 6:33 am

Re: How to put a digit in a specific tag position

Post by Jesus »

Any sugestion?

JohnCZ
Posts: 73
Joined: Wed Jun 27, 2012 1:17 am
Location: CZ
Contact:

Re: How to put a digit in a specific tag position

Post by JohnCZ »

Hi

you could use string as a format. Where every button will toggle diferent Tag 0 or 1 and then you could save these tags in your value. So you will have message [000000] and if someone push some button you will see it in message [001000] or [001001] ats. We use something similiar but only for I/Os
Attachments
Project1.zip
iX Dev 2.0 V.482
(26.37 KiB) Downloaded 861 times

Jesus
Posts: 5
Joined: Fri Jul 19, 2013 6:33 am

Re: How to put a digit in a specific tag position

Post by Jesus »

Thanks JohnCZ. I'll try this solution, but i'm not sure if this works for me.

Post Reply