hhtokpinar / sqfEntity

SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands on SQLite database easily and quickly with the help of fluent methods similar to .Net Entity Framework. SqfEntity also generates add/edit forms with validations and special controls (DropDown List, DateTime pickers, Checkboxes.. etc) for your table.
379 stars 101 forks source link

How to create Alias name for a value fetched from Database while exporting/ displaying in print statement #252

Closed SrujanMungara closed 2 years ago

SrujanMungara commented 2 years ago

How to query alias name for a value which is fetched from database while exporting/Displaying in print statement.

For Example:

"Select user as UserName from "UserManagement" where user ="123"";

hhtokpinar commented 2 years ago

you mean something like this?

// you can manipulate field names by YourModelFields.fieldname.toString('alias name') like this:
final data = await Product().select(columnsToSelect: [ProductFields.id.toString('ProductId')]).toListObject();

// then you can get ProductId field that alias name for id
 print(data[0]['ProductId'].toString()); 
SrujanMungara commented 2 years ago

yeah it worked. thanks.

hhtokpinar commented 2 years ago

Besides, you can run MyDBModel.execDataTable(sql) with your own SQL statement

SrujanMungara commented 2 years ago

Will try it. thanks