Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object repository datatable as variables, and datatable count with iteration - done #953

Closed
marcelocecin opened this issue Mar 2, 2021 · 17 comments
Assignees
Labels

Comments

@marcelocecin
Copy link

Hello
attachment error is occurring


@kensoh kensoh self-assigned this Mar 3, 2021
@kensoh
Copy link
Member

kensoh commented Mar 3, 2021

Hi Marcelo! You can specify the datatable using tagui flow.tag datatable.csv.

Above error and file naming is probably you are referring to the old documentation.

For current doc - https://tagui.readthedocs.io/en/latest/advanced.html#datatables

Also, to use commas , in your CSV, you can enclose the whole thing in double quotes. eg "11.021,00"

@kensoh kensoh changed the title error with conditions and database Error with conditions and database - use new syntax to call datatable.csv see here Mar 3, 2021
@kensoh kensoh added the query label Mar 3, 2021
@marcelocecin
Copy link
Author

Hi Ken!
thanks for the tip for using the comma inside the CSV
I'm using the command: tagui 11_ifDB.tag 11_ifDB.csv

@kensoh
Copy link
Member

kensoh commented Mar 4, 2021

Oh I get the problem now, the `varstring` works because it will retrieve data from your csv file. But using varstring directly in the condition, TagUI assumes that it is a variable and doesn't read from the csv file the value. Let me chew on this what is the best solution, and if we can make a patch to solve this. CC @ruthtxh (think the issue you ran into previously with csv_row())

@kensoh kensoh changed the title Error with conditions and database - use new syntax to call datatable.csv see here Error with conditions and database - to explore access object repository as variables Mar 4, 2021
@kensoh kensoh changed the title Error with conditions and database - to explore access object repository as variables Error with conditions and database - to explore using object repository as variables Mar 4, 2021
@marcelocecin
Copy link
Author

@kensoh
Copy link
Member

kensoh commented Mar 4, 2021

Yes, I don't think there's a direct solution now, the parsing for the backticks happens before script runs and only for normal steps, it does not parse for lines that are in JS code, because variables would not have `` in that context. Will think over.

@kensoh
Copy link
Member

kensoh commented Mar 4, 2021

A workaround in the meantime is below, after the 2 steps below, varstring can be used in the if condition -

dump `varstring` to variable.txt
load variable.txt to varstring

@kensoh
Copy link
Member

kensoh commented Mar 4, 2021

If this works, you can use this workaround for the time being. In the next release, I'll see if there's a good permanent fix.

@marcelocecin
Copy link
Author

it works !
thanks Ken !

@kensoh
Copy link
Member

kensoh commented Mar 5, 2021

Welcome Marcelo, thanks for raising this to us! Your feedback helps us to improve TagUI.

Reopening issue to investigate on a permanent solution for next release.

Cc @ruthtxh

@kensoh kensoh reopened this Mar 5, 2021
@kensoh kensoh added feature and removed query labels May 22, 2021
@kensoh kensoh changed the title Error with conditions and database - to explore using object repository as variables Error with conditions and database --> use object repository datatable as variables - done May 22, 2021
@kensoh kensoh changed the title Error with conditions and database --> use object repository datatable as variables - done Conditions and datatable --> use object repository datatable as variables - done May 22, 2021
@kensoh
Copy link
Member

kensoh commented May 22, 2021

Above commit works with below examples. If a field has spaces, the spaces will be replaced with underscore for valid variable names. If there is single quote in the field data, it will be escaped automatically to not break JavaScript compilation.

You can download the latest copy of TagUI with this and unzip to overwrite your existing installation (please drag the folders under tagui\src to overwrite your existing installation) - https://github.com/kelaberetiv/TagUI/archive/master.zip

In the next release, this will become part of the packaged zip files.

repository.tag

echo `name`
echo `date of birth`
echo `home_town`

if name equals to 'Andy Garcia'
    echo YES
if date_of_birth equals to '01/01/1991'
    echo YES
if home_town contains 'It'
    echo YES

tagui_local.csv

object, value
name,Andy Garcia
date of birth,01/01/1991
home_town,South\nItaly

datatable.tag

echo `name`
echo `date of birth`
echo `home_town`

if name equals to 'Andy'
    echo YES
if date_of_birth equals to '01/01/1991'
    echo YES
if home_town contains 'It'
    echo YES

data.csv

#,name,date of birth,home_town
1,Andy,01/01/1991,Italy
2,Ryo,02/02/1991,Japan

Fyi @ruthtxh

@kensoh kensoh changed the title Conditions and datatable --> use object repository datatable as variables - done Conditions and datatable --> use object repository datatable as variables - done, but to review May 24, 2021
@kensoh
Copy link
Member

kensoh commented May 24, 2021

To review if defining all datatable and object repository values is better, instead of defining what is being used in TagUI steps.

@kensoh kensoh changed the title Conditions and datatable --> use object repository datatable as variables - done, but to review Conditions and datatable --> use object repository datatable as variables - done, review May 24, 2021
@kensoh kensoh changed the title Conditions and datatable --> use object repository datatable as variables - done, review Conditions and datatable --> use object repository datatable as variables - done, to review May 24, 2021
@kensoh
Copy link
Member

kensoh commented May 24, 2021

Above commit is v2 of this enhancement, it will process all fields regardless of whether a field is used in TagUI steps.

repository.tag

echo `name`
echo `date of birth`
echo `home_town`

if name equals to 'Andy Garcia'
    echo YES
if date_of_birth equals to '01/01/1991'
    echo YES
if home_town contains 'It'
    echo YES
if favourite_color equals to 'blue'
    echo YES

tagui_local.csv

object,value
initials,AG
name,Andy Garcia
date of birth,01/01/1991
favourite color,blue
home_town,South\nItaly
occupation,wine maker

datatable.tag

echo `name`
echo `date of birth`
echo `home_town`

if name equals to 'Andy Garcia'
    echo YES
if date_of_birth equals to '01/01/1991'
    echo YES
if home_town contains 'It'
    echo YES
if favourite_color equals to 'blue'
    echo YES

data.csv

#,name,date of birth,home_town,favourite color
1,Andy,01/01/1991,Italy,blue
2,Ryo,02/02/1991,Japan,orange

@kensoh
Copy link
Member

kensoh commented May 24, 2021

Users can download the latest copy of TagUI with this and unzip to overwrite your existing installation (please drag the folders under tagui\src to overwrite your existing installation) - https://github.com/kelaberetiv/TagUI/archive/master.zip

In the next release, this will become part of the packaged zip files.

@kensoh
Copy link
Member

kensoh commented May 24, 2021

Also, as part of the change, following will be the new way to access iteration (which iteration run in a datatable) -

new way

if iteration equals to 1
    // do login steps

old way

if `[iteration]` equals to 1
    // do login steps

@kensoh kensoh changed the title Conditions and datatable --> use object repository datatable as variables - done, to review Conditions and datatable --> use object repository datatable as variables - done May 24, 2021
@kensoh kensoh changed the title Conditions and datatable --> use object repository datatable as variables - done Use object repository datatable as variables and datatable run count with iteration - done May 24, 2021
@kensoh kensoh changed the title Use object repository datatable as variables and datatable run count with iteration - done Object repository datatable as variables, and datatable count with iteration - done May 24, 2021
@kensoh
Copy link
Member

kensoh commented Jun 4, 2021

Above commit adds v3 of this feature, to make it robust for edges. Otherwise it is possible for some header names to break the execution due to invalid JavaScript variable naming convention.

Users can download the latest copy of TagUI with this and unzip to overwrite your existing installation (please drag the folders under tagui\src to overwrite your existing installation) - https://github.com/kelaberetiv/TagUI/archive/master.zip

In the next release, this will become part of the packaged zip files.

@kensoh
Copy link
Member

kensoh commented Jun 4, 2021

tested ok for -

datatable.csv

#,a1,1a,_,_1,!@#$^&^*%%^?><{}|\][';,test
1,2,3,4,5,6,7

tagui_local.csv

object,value
a,1
a a,2
a1,3\n4
1a,3\r\n4
,123
_1,1
_,2
a~!@#$%^&*()_+{}|":?></.';\][=-z,3
~!@#$%^&*()_+{}|":?></.';\][=-,4

@kensoh
Copy link
Member

kensoh commented Jun 18, 2021

Closing issue, change included in latest packaged release - https://github.com/kelaberetiv/TagUI/releases/tag/v6.46.0

@kensoh kensoh closed this as completed Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants