• Support
  • Articles
  • Resources
  • Products

Getting type mismatch on my "for i" command

Moderator: boris

4 postsPage 1 of 1

rookie1082
Newbie

Posts:
3
Joined: Thu Dec 22, 2016 6:35 pm
by rookie1082 » Thu Dec 22, 2016 6:46 pm
Getting a type mismatch when trying to use:

Code: Select all

  1. for i 1 16


I want the #1 to be appended to a strconcat to make a full command... it errors out on the line in yellow: i have all other variables defined prior... it was working last night, now today its not and i cannot figure out what i am missing or what i took out...

Code: Select all

  1.  
  2. inputbox 'How Many Blades do you have to configure?' 'SAP BLC7000 Config'
  3. str2int blades inputstr
  4.  
  5. for i 1 blades
  6. mpause 500
  7.  
  8. hponcfg = 'hponcfg '
  9. strconcat hponcfg '"IP_Add"="'
  10. strconcat hponcfg IPAdd
  11. strconcat hponcfg '","Sub"="'
  12. strconcat hponcfg Subnet
  13. strconcat hponcfg '","Gate"="'
  14. strconcat hponcfg gateway
  15. strconcat hponcfg '","Hostname"="'
  16. strconcat hponcfg Hostname
  17. strconcat hponcfg '","Domain"="'
  18. strconcat hponcfg Domain
  19. strconcat hponcfg '" '
  20. strconcat hponcfg i
  21. sendln hponcfg
  22. wait 'OA-'
  23. next
  24. goto Done
boris
Moderator, LogMeTT and TTLEditor developer

Posts:
1590
Joined: Sat Jan 08, 2005 2:52 pm
by boris » Thu Dec 22, 2016 7:17 pm
You cannot concatenate string and integer. You need to convert i into string using int2str and then concatenate. Here is the description http://ttssh2.osdn.jp/manual/en/macro/c ... t2str.html
Thanks.
Best regards,
Boris
rookie1082
Newbie

Posts:
3
Joined: Thu Dec 22, 2016 6:35 pm
by rookie1082 » Thu Dec 22, 2016 7:41 pm
ok i figured it out..

Thanks Boris!!!
Trevor
Guru

Posts:
467
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Sat Dec 24, 2016 2:54 pm
E.g. as a one liner

Code: Select all

  1. sprintf2 hponcfg 'hponcfg "IP_Add"="%s","Sub"="%s","Gate"="","Hostname"="%s","Domain"="%s" %d http://10.10.192.17/SAP/HP/BLC7000/ILO_STATIC.xml' IPAdd, Subnet, gateway, Hostname, Domain, i
  2.  


Note %d is used for integer i and %s for the other variables (assuming that they are all strings).
Display posts from previous:
Sort by:

4 postsPage 1 of 1

Users browsing this forum: No registered users