Is there a way to assign a string variable with the contents of a string from the GlobalTextList?
Also of import, when it assigns the variable from the GlobalTextList it uses the correct language from the GlobalTextList.
Do you want to get from static dynamic text list a string in ST?
This function will do it:
FUNCTION F_GetText : STRING
VAR_INPUT
sTextList : STRING;
sId : STRING;
END_VAR
sTextList := CONCAT('Port_851.',sTextList);
F_GetText := VisuElems.CmpDynamicText.DynamicTextGetText(
pstTextList:= ADR(sTextList),
pstTextIndex:= ADR(sId)
)^;
If its a static text, give as argument the number as STRING
If you are using TwinCAT this approach needs the license of HMI. Other option is though ADS and an external program to do the job.
Related post:
Codesys 3. How to get the translations from static or dinamic text file in ST?
I was able to do solve this by using the TextListUtils library.
Related
when we can not determine which variable will be determine by a constant,i use a list use a list to store variables ,but the BooleanPolynomialRing do not support change the BooleanPolynomial by variables in list, It seems that it can only be changed by using the variable name; but when we encounter this situation ,is there another way to solve this problem
from sage.crypto.boolean_function import BooleanFunction
R=BooleanPolynomialRing(4,"a,b,c,d")
R.inject_variables()
S=R.gens()
print(S)
f=a*b+b*c
print(f(a=1))
print(f(S[0]=1))
enter image description here
So I'm developing a API using Go together with ORM package Entgo and Postgres. Is there a way to handle the errors same or similar way as they are solved in pg package where I have all needed information why query failed?
All I found in ent go are this methods but they only return bool
ent.IsNotFound(err)
ent.IsConstraintError(err)
ent.IsNotLoaded(err)
ent.IsValidationError(err)
It would be great to have something similar like pg.Error:
type Error struct {
Severity string
Code ErrorCode
Message string
Detail string
Hint string
Position string
InternalPosition string
InternalQuery string
Where string
Schema string
Table string
Column string
DataTypeName string
Constraint string
File string
Line string
Routine string
}
So I asked this same question on package repo and this is the answer I got from repo Maintainer.
Ent wraps or returns the underlying driver errors. So, you can either use type-assertion or errors.Is/errors.As helpers to extract these types.
See examples in our integration-test:
https://github.com/ent/ent/blob/60e0328/entc/integration/integration_test.go#L1845-L1858
https://github.com/ent/ent/blob/60e0328/entc/integration/integration_test.go#L423
Running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title?
PROGRAM PLC_PRG
VAR
itfAxisRef : SM3_Basic.IAxisRef;
pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3;
END_VAR
pAxisRefSm3 := itfAxisRef.GetAxisRefPointer;
Trying to compile the above throws the following error
C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3'
which has me really confused because I've never seen the type GETAXISREFPOINTER before and the documentation for .GetAxisRefPointer states that it returns POINTER TO AXIS_REF_SM3
https://help.codesys.com/webapp/3dvrBKsuKjYfmeP1KzrJnylfstc%2FGetAxisRefPointer;product=SM3_Basic;version=4.9.0.0
As for why I'm trying to use this method, I'm trying to loop through the array of axes in SM3_Robotics.AXIS_GROUP_REF_SM3 and pass them to SM3_Basic.MC_ReadStatus in order to get their individual SM3_Basic.SMC_AXIS_STATE (not only the SM3_Robotics.SMC_AXIS_GROUP_STATE) for debugging
Is there a better way to achieve the above without using the axes array?
GetAxisRefPointer is a Method, try:
pAxisRefSm3 := itfAxisRef.GetAxisRefPointer();
when you enter function??, besides the info you get the source code of the function if there is available.
Is there a way of?:
1) get the code as str object
2) edit in place similar to %load
Assuming that you have the module and function names as "module" and "function" string variables, then
from inspect import getmembers, isfunction, getsource
internal_module = __import__(module)
internal_functions = dict(getmembers(internal_module, isfunction))
source_code = getsource(internal_functions[function])
will give you a dictionary (internal_functions) containing all functions in the module and a string (source_code) containing the source of that specific function.
You would then have to manipulate the string in order to edit the function, I think.
In my MVC application i created the view Index.cshtml and there i declared the C# variable..
Eg: string selectedvalue="";
now how to use it in the javascript function code which i wrote with in this Index.cshtml, so that i can append some text to this string in javascript function?
string selectedvalue="";
// Coding Part
function onchangeFT(e)
{
'#selectedvalue'= e.value; //e.value come form combobox and it is should be assigned to "selectedvalue"
alert('#selectedvalue');
}
It is giving me error...
any idea to solve this issue?
I think you are confused about what you are doing in this case.
You have declared the C# variable #selectedValue using MVC razor syntax. You can then use this variable to inject it's value into the content that is output to the client. However, you cannot assign back to this variable from client side javscript code as it does not exist. Your error will be in relation to the fact that you are actually attempting to assign an object value back to a literal string declaration which is invalid.
In your example
'#selectedValue'=e.value;
would translate to
'' = e.value;
This is because MVC razor will automatically translate the c# param into it's value and output it literally. In order to assign a variable to the e.value you should create a javascript value as part of your script block which your script will then identify as usable target variable.
For instance:
var selectedValue = '';
selectedValue = e.value;