dc-pico

MrPLC Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dc-pico

  • Rank
    Hi, I am New!

Profile Information

  • Country United States
  1. Citect...text string to sql

    Yes. That's a good idea. We did create a new Unity Pro project to check the string from a new Citect project. The problem was still there. Just like before, the string could be added to the animation table from Unity and shown in Citect, but not the other way around with the input popup. After much additional testing and trial and error, we installed OFS 3.60 SP3 which has fixed this issue with the writing strings to the PLC from Citect. Wasan, thank you so much for your help!
  2. Citect...text string to sql

    Hi, We have implemented the following code and it works with local string variables. The ' symbol was the problem. Thank you. FUNCTION foo() INT hsql; hsql = SQLConnect("DSN=foo_database"); SQLSet(hsql,"INSERT INTO foo_table(foo1, foo2, foo3) VALUES("); SQLAppend(hsql, (foo3) + ","); //foo3 is a plc integer value SQLAppend(hsql, (foo2) + ","); //foo2 is a plc integer value SQLAppend(hsql, "'"+ (foo) + "')"); //foo is a plc string SQLExec (hsql, ""); SQLDisconnect (hsql); END And we thought that the problem with writing a string to the plc was resolved but the problem remains. We have created a string variable in the plc using Unity Pro. Then we import the tag over to Citect and do what you suggested before using cicode. It does not appear that the entered string '123ABC' in sText1 ever gets written to the plc when we watch the animation table.  Sometimes the entered string will flash on the HMI screen for just a moment, but then it goes blank immediately. Any other ideas would be appreciated! Thank you.
  3. Citect...text string to sql

    This a really helpful start to get the form working. Since that part is working successfully, it solves the problem of entering text and having it held in the plc. Thank you! The next part that I need to get working is the database part. I'm still getting an error when I try to write to the Access .mdb using the SQL. So for instance in cicode: FUNCTION foo() INT hsql; hsql = SQLConnect("DSN=foo_database"); SQLSet(hsql,"INSERT INTO foo_table(foo1, foo2, foo3) VALUES("); SQLAppend(hsql, (foo3) + ","); //foo3 is a plc integer value SQLAppend(hsql, (foo2) + ","); //foo2 is a plc integer value SQLAppend(hsql, (foo) + ")"); //foo is a plc string SQLExec (hsql, ""); SQLDisconnect (hsql); END If the value of foo is "123ABC", SQLError outputs this message: If I change the value of foo to "15", the database records the values without issue.   Any additional insights will be appreciated!  
  4. Citect...text string to sql

    Hi all, Needing an assist. We been trying to send a local var alphanumeric string to an Access DB using the SQL. We can successfully send integer/real values to the DB when they are entered via the var=FormNumPad() popup. I use SQLSet, SQLAppend, and SQLExec. Since we cannot generate text using FormNumPad(), we use the var=Input() command. The local var seems to hold the value entered on the screen, but a plc address writes the value for a moment then wipes it out. Then when we use the same SQL commands for the string var, the system immediately starts throwing errors. My guess is because the value is null. Any ideas? Is there a proper way to generate a keypad or textbox on screen? We are using v. 2016 on a Win10 box. Thanks in advance.