How to Get the value of variable passed to the Fast-Report (Version : 2022) - delphi

//Adding a Variable "IsForDigitalSignature" to the Fast Report.
frReport.Variables.AddVariable('MyCategory','IsForDigitalSignature', True);
// Executing the report
frReport.PrepareReport(True);
//In the Report, i am changing the value of the variable to false in the script
// Set('IsForDigitalSignature',false);
//Getting the Value of the
frReport.Variables['IsForDigitalSignature'];
\ this will still return True even though I have set the variable to False
Can anyone tell me how to pass a variable and then get the modified value after the report is prepared?

frReport.EngineOptions.DestroyForms:= False;
frReport.Variables.AddVariable('MyCategory','IsForDigitalSignature', True);
//In the Report, i am changing the value of the variable to false in the script
// Set('IsForDigitalSignature',false);
//Getting the Value of the Variable
frReport.Variables['IsForDigitalSignature']; \\ This return now False as expected
I posted this with the Support Team of Fast-report. They replied with a solution.
Thank You

Related

Possible processmaker 4 bug Accesing an array of objects process variable within a script for a calculated property

On my process, I have a variable that is an array of objects similar to the following:
"llista-finques" : [
{
"FIN_ID": "H10",
"FIN_NOMBRE": "PLUTO VIVIENDAS",
"FIN_PROPIETARIO": "H10",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H11",
"FIN_NOMBRE": "PLUTO PARKING",
"FIN_PROPIETARIO": "H11",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H12",
"FIN_NOMBRE": "PINTO VIVENDES",
"FIN_PROPIETARIO": "H12",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H16",
"FIN_NOMBRE": "ZURUBANDO",
"FIN_PROPIETARIO": "H16",
"FIN_LINIA_NEGOCIO": "Horizontal"
} ......
I am trying to create a Calculated Propery in one of my forms that needs to create a subset of this array filtering by object property. In order to do so, I was hoping to use the following javascript for the calculated field:
return this.llista-finques.filter(finca => {return finca.FIN_PROPIETARIO === this.Id_client});
For some reason this code produces no result, and after many tests, I have arrived at the conclussion that the variable "this.llista-finques" is simply not accessible from the script, although it is available in the process data.
If I change the Calculated Property script to simply return the value of the variable as bellow:
return this.llista-finques;
or even someting that simply should return a string:
return this.llista-finques[0].FIN_ID
the calculated property produces no result.
If I do exaclty the same with any of the other process variables that are not arrays of objects the calculated property seems to work correctly.
Al the testing I have done is using the screen preview debuging tools of Processmaker 4.
Is there a limitation on the kind of variables I can use for calculated properties? Is this a processmaker bug?
This is embarassing ... after testing and testing and testing I figured out that the problem was due to the name of the variable I was using. Can't use a name with the character '-' ....
Once I corrected the variable name it all worked as expected.

Referencing a vim.g variable in the same function it was declared in

I've been working on a plugin that lets you customize your color scheme based on the color values you provide. I've been stuck on a bug for two days now and was wondering if anyone has run into this issue
In my setup function I declare vim.g.black_3 = black_3
generate-colors.lua:
local M = {}
M.setup function()
-- Generate colors based on setup config values up here
vim.g.black_3 = black_3
end
return M
I reference that value in my config but it doesn't recognize it
colors-config.lua:
require("generate-colors").setup({
custom_highlights = {
SignColumn = {bg = "#333333"} -- works
SignColumn = {bg = vim.g.black_3} -- read as empty
}
})
I'm assuming that this is because the vim.g variables only exist after the setup function is called, I've tried returning the values from setup, and declaring vim.g variables after the setup function but no luck.

how can I do this with the variables in lua?

How can I make the 2 "print" give me true?
Code:
Config = {}
Config.option1.general = true
Config.option2.general = false
print(Config.option1.general)
print('Config.'..'option1'..'.general')
Output:
true
Config.option1.general
Excuse me for my ignorance
The objective was to create a function to which you give the option and execute a code with the variables of the corresponding list.
Just create a function that takes as input an option string, and use the string as a key into the Config table:
function getOption (opt)
return Config[opt].general
end
Then you can use the returned value however you like:
> getOption('option1')
true
> print(getOption('option1'))
true
> if (getOption('option1')) then print 'Yay!' else print 'Aw...' end
Yay!
If you want to live dangerously, you can use load to run a chunk of code from a string. Using this feature with user input is begging for security problems, though.
Just write a function that takes a string specifying the option, and use that input to fashion a string representing the chunk. The load function returns a function that has the chunk as its body, so you will need to call that returned function to get the result from the chunk:
function getOption (opt)
local cmd = 'Config.' .. opt .. '.general'
return load('return ' .. cmd)()
end
With getOption('option1'), the cmd string becomes 'Config.option1.general', and this is concatenated with 'return ' to create the chunk 'return Config.option1.general' which is passed to load. The statement load('return Config.option1.general')() calls the function returned by load, and the returned value is returned again from the getOption function.
Sample interaction:
> getOption('option1')
true
> getOption('option2')
false
the first print is collecting a variable and therefore displaying the value of this variable
the second print is already collecting a STRING. A string is a set of characters, they represent only text, and therefore that text will be displayed
for example, imagine that we have a variable test = true
if you do print(test), the value of the variable will be displayed, that is, true. Now, if you get print("test"), the "" means that we are talking about a text "test", not the variable test, so test will be displayed instead of true.
Note that in the second print, 2 dots .. are used, this is called CONCATENATION, it is when we join two or more strings, that is, two or more texts in one
For this reason there is no way you print true on the second print, because you are collecting a STRING with the name of the variable, and not the variable itself

Dart compare two strings return false

Im new to dart and have a problem during building my Flutter application.
I have a firestore database as a backend and im getting data from there.
When i want to compare part of the data called status with the text 'CREATED', using == comparator, dart will return false.
Can someone explain why and how to check it properly?
rideObject is a Map
Update:
Here is the function that has the condition in it:
Widget _getPage() {
if (rideObject == null) {
return OrderRidePage(
address: address,
ridesReference: reference,
setRideReference: this._setRideReference);
} else {
print(rideObject['status']);
if (rideObject['status'] == "CREATED") {
return LoadingPage(
removeRideReference: this._removeRideReference,
rideReference: rideReference);
} else {
return RidePage(
address: address,
ridesReference: reference,
setRideReference: _setRideReference);
}
}
}
The print statement returns to output:
I/flutter (15469): CREATED
Here you can see the structure of the rideObject
Funnily enough, the rideObject["status"] is String type as shown in here in console:
rideObject["status"] is String
true
"CREATED" is String
true
rideObject["status"]
"CREATED"
rideObject["status"] == "CREATED"
false
The String you got from your server is probably encoded and contains special character which you can't see, try to compare the hex values of both of the strings, and then replace all the special characters from the String returned by the server.
Using this, you can see the actual non visible difference between the two strings:
var text1 = utf8.encode(hardcodedText).toString();
var text2 = utf8.encode(textFromServer).toString();
If both are really strings, you can use "compareTo" which will return 0 if both are equal.
if(str1.compareTo(str2)==0){
}
It is explained here:
https://www.tutorialspoint.com/dart_programming/dart_programming_string_compareto_method.htm
I don't have a particular solution to this, but I updated to latest Flutter version that came up today, moved the "CREATED" string into constant and resolved an unrelated warning for another part of the application, and it suddenly started to work.
The answer for this problem is in the documentation of flutter:
https://api.flutter.dev/flutter/dart-core/String/compareTo.html
you can do:
(var.compareTo('WORD') == 0)
are equivalent
.compareTo()
Returns a negative value if is ordered before, a positive value if is ordered after, or zero if and are equivalent.thisother
Building off #yonez's answer, the encoding may be different after a string has been passed through a server.
Instead of: String.fromCharCodes(data)
Try using: utf8.decode(data)

Team Developer 2005.1 - Into Variable Always Empty

We are handling a legacy code which based on Team Developer 2005.1
There is a query like
!!CB!! 70
Set sSqlCommand = '
SELECT name, value
INTO :sName, :sValue
FROM av_system_settings
WHERE name LIKE \'Company_\%\''
If NOT SqlPrepareAndExecute( hSqlMain, sSqlCommand )
Return FALSE
Loop
If SqlFetchNext( hSqlMain, nFetch )
...
Here the into variable :sName, :sValue are Strings but it always have empty value although the record has been looped correctly through SqlFetchNext
The into variable on other place are all fine. Just not working here one place.
Have run out of brain on this... Any idea? Guys :)
For testing, you can use SqlImmediate(sSqlCommand ) instead of sqlprepareandexecute( ). If sName and sValue have value after
executing sqlImmediate means sql working fine.
Make sure SqlConnect() function returns true value. If it returns false then make sure database creditionals are correct.
If the sValue variable need to hold Long data then please have a look on SqlSetLongBindDatatype ( ) function.
Check the value of sql handle hsqlMain, if it have a postive value or one it means that handle connected properly. Otherwise
if the handle value is null or zero, it means handle not connected.
Try to use SqlFetchRow ( hsqlMain, nRow, nFetch ) and increment the value of nRow by 1 till function return false or the value of nFetch becomes FETCH_EOF.
Set nRow = 0
While (TRUE)
If not SqlFetchRow( hsqlMain, nRow, nFetch )
Break
Set nRow = nRow + 1
Check nFetch after SqlFetchNext to be sure a record was found.
If nFetch = FETCH_Ok , a record was found.
So try calling SqlVarSetup(hSqlMain) before the SqlFetchNext , so the into vars have context.
Also try qualifying the into vars e.g. :hWndForm.frmTest.sName .
If nFetch = FETCH_EOF , no record was found .

Resources